Ok, here's a simple question we ask everyone to warm up: you have accidentally removed execution rights from /bin/chmod...

>Ok, here's a simple question we ask everyone to warm up: you have accidentally removed execution rights from /bin/chmod, what do you do?

Use live cd to fix it.

Ask you why the fuck you made me us linux, this shit is awful. I'm a god damn windows admin.

>windows admin
Pathetic.

there are a bazillion ways to do it
umask 022
touch chmod2
cat /bin/chmod > chmod2
./chmod2 +x /bin/chmod

oh umask doesn't work the way I thought it did. Anyways you could replace the first two commands with something like cp /bin/ls chmod2 and it would work

you could also write a simple C program that uses chmod() (from sys/stat.h), compile it and run it

Good solution imo, not the fastest for sure but very easy to do and hard to fuck anything up further

"cat" for a binary file? Is chmod a script?

>Uh, did i walk into a wrong office? Because i applied to as Electrical Network Engineer

>Hmm, okay. Electric kettle in our kitchen is broken, can you take a look?

Well i probably walked in the wrong room since i'm a lab technician but i can fix that with the Lubuntu usb stick i always carry. You can thank me later.

Good luck recruiting pajeets, btw. thx,bye

well i'm a lab technician but i can fix that too with the soldering iron i always have in the trunk of my car.
good luck with your homeless pajeets sir. have a nice day.

never cat a bin file. use dd for binary files.

Fire up a backup.

busybox chmod +x /bin/chmod

Wtf is this solution? How does it work, can someone explain it for this brainlet

Can you cook a good vegan curry? I don't think so.

rtfm

How would you make chmod2 executable? Don't you have the same problem as before?

That's why he wrote:
He will copy the permissions from 'ls'.

>sea aids what? where am I

Use setfacl.

dd if=/bin/chmod of=/bin/chmod.tmp
/bin/chmod.tmp +x /bin/chmod
rm /bin/chmod.tmp

The only correct answer.

does dd set permissions of the current user?

since when do new created files have execute rights?

Look up the answer in a linux reference book cause there's no way I'm learning an irrelevant system other than for simple commands dealing with server shit

ah, good points. do this then.
su
cp /bin/ls /bin/chmod.tmp
dd if=/bin/chmod of=/bin/chmod.tmp
/bin/chmod.tmp +x /bin/chmod
rm /bin/chmod.tmp

...or just install busybox and do busybox chmod +x /bin/chmod

apt install coreutils --reinstall

sudo apt-get purge chmod && sudo apt-get install chmod

Single user mode baby

node -e "require('fs').chmodSync('/bin/chmod', 511)"

cat will print the contents of binary files, and you can pipe this and preserve the functionality of the file through it.

I just tried it on chmod, seems to work, granted I didn't do a complete unittest of the copy so it's possible some things didn't copy properly, but if cat is dumb enough it'll work just fine.

that's why I had the umask line in there, but it turns out that my umask was wrong

find a nice binary in /bin (like cp) - must be a binary not a symlink, etc.

as root:
cd ~/
cp /bin/cp ~/
dd if=/bin/chmod > cp
the cp file in root's home is now a chmod binary with exec permissions.

I just tested this; works fine.

>sudo apt-get
Uguboonto user detected.

>dd if=/bin/chmod > cp
>not dd if=/bin/chmod of=~/cp
For what purpose?

cp /bin/chown ~/chmod
dd if=/bin/chmod of=~/chmod
./chmod +x /bin/chmod
rm ./chmod

Put my knowledge about system calls to use.

>wget chmod.com/chmod.exe.rar
>7z x *.rar
>sudo ./chmod.exe a+x /bin/chmod
do I win the cookie?

setfacl it a bit first
then busybox chmod the shit out of /bin/chmod
once it's already a changed binary, bindfs and deelply chmod it without respecting its permissions
then kvm boot an sysrescuecd image that mounts the filesystem and chmods it some more to finish the chmodding

Nobody has sued me yet, am I hired?

flatten and reinstall windows probably

windows server? hahahahahaha

I can cook a relatively good one, I think. It's better with meat though.

sudo /lib64/ld-linux-x86-64.so.2 /usr/bin/chmod +x /usr/bin/chmod

write a program in C to call the chmod syscall directly

how about this then:
>windows has accidentally removed exe file association from the registry, what do you do?
(ps. i have seen this happen before)

Same thing. Since you are in the home directory of root and you copied cp into the same directory you can relatively path it.

>irrelevant
>runs half the internet

>rm /bin/chmod
>[package manager] install coreutils