Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

chmod u+s,o-rwx myUserGroup myFile
share|improve this question

migrated from stackoverflow.com Nov 30 '12 at 17:58

This question came from our site for professional and enthusiast programmers.

1  
do you mean ordinary users cannot use chmod? –  Chris Nov 30 '12 at 14:06
    
ordinary users cannot halt, reboot and shutdown. –  Leonel AE Nov 30 '12 at 14:31
    
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 Nov 30 '12 at 14:44
    
What am I doing here "chmod u+s,o-rwx" ? specially the u+s part –  Leonel AE Nov 30 '12 at 14:46
    
Google, man chmod, "Unix in a Nutshell," etc. Please show research effort. –  AAA Nov 30 '12 at 15:23

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
    
That code is working. I tired that because I have to avoid using sudo for each user. –  Leonel AE Nov 30 '12 at 14:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.