What do these chmod parameters mean?

0

What changes are being applied by u+s,o-rwx in the below?

chmod u+s,o-rwx myUserGroup myFile

Leonel AE

Posted 2012-11-30T14:03:38.947

Reputation:

1do you mean ordinary users cannot use chmod? – Chris – 2012-11-30T14:06:10.697

ordinary users cannot halt, reboot and shutdown. – None – 2012-11-30T14:31:26.977

What is your question? And why did you need the -f on /usr/bin/shutdown? If it was because there already was a /usr/bin/shutdown, replacing one with a symlink to the other was probably not a good idea. – Jonathan Leffler – 2012-11-30T14:44:26.957

What am I doing here "chmod u+s,o-rwx" ? specially the u+s part – None – 2012-11-30T14:46:09.433

Google, man chmod, "Unix in a Nutshell," etc. Please show research effort. – djechlin – 2012-11-30T15:23:19.933

Answers

1

The chmod u+s,o-rwx command applies two operations to the files.

  • o-rwx — remove read, write and execute permission from others.
  • u+s — add the SetUID bit.

The SetUID or SUID bit means that when the program is executed, the process created will acquire all the privileges of the program's owner; the effective UID of the process will be the same as the UID of the owner of the program (most likely, that will be root). This allows someone who would not normally be able to do something to do it via this program.

The canonical example of a SUID program is passwd. It is either SUID or SGID (SetGID) and allows people who would not otherwise be able to edit the password file (ordinary users) to edit the password file.

The SUID mechanism is extremely powerful; it is also extremely dangerous. Use with extreme caution.

Jonathan Leffler

Posted 2012-11-30T14:03:38.947

Reputation: 4 526

1

It looks like you are trying to set the suid bit for the binaries but that won't work. I suspect it would be easier to allow the users to run the tools via sudo.

stsquad

Posted 2012-11-30T14:03:38.947

Reputation: 449

That code is working. I tired that because I have to avoid using sudo for each user. – None – 2012-11-30T14:30:31.720