What does chmod 7760 <directory> do in CentOS 7 bash?

4

I typed the command chmod 7760 by accident. I meant to type chmod 770 and now I'm curious what the first command did exactly.

After typing chmod 7760 , I typed ls -Al and the directory name was white with a blue highlight. Also, I was root the entire time. Any ideas?

Jamal McTravis

Posted 2015-06-17T15:26:39.730

Reputation: 41

Answers

4

In this case, by setting 7760, you have set:

Owner: 7
OwnerGroup: 6
Other:0

The leading 7 activates 3 special classes of permissions, consisting of SetUID, SetGID, and "the Sticky bit" (which restricts delete to only the owner, even if the group or other have write access). Sticky is why your text turned blue. if you reset the permissions with:

chmod 0760 path/to/target

it will turn off setUID, setGID, and Sticky. if you still want to change it to 770, use chmod 0770 path/to/target.

See more about these special permissions here: https://en.wikipedia.org/wiki/Setuid

They can be very useful. I use SetGID and Sticky on multi-user shared folders all the time.

Frank Thomas

Posted 2015-06-17T15:26:39.730

Reputation: 29 039

Shouldn't he use chmod 0770 to get back to what he originally wanted? – DavidPostill – 2015-06-17T15:55:29.397

good point, op did say they fatfingered it. – Frank Thomas – 2015-06-17T15:58:17.673