The case of special permission on Linux

-1

I am a beginner in the Linux system and when I learned the commands, I learned to study the permissions and the owners. I understood all the commands but did not understand the special permission. I am referring to chmod u+s, chmod g+s, and chmod u+t. Can someone explain this for me?

robert

Posted 2018-07-11T10:17:02.743

Reputation: 11

Question was closed 2018-07-19T19:07:43.303

2Please be more elaborate. What commands did you learn? What did you understand and what didn't you understand? Are you talking about the sbit or what "special permissions" are you talking about? – Seth – 2018-07-11T10:20:52.727

chmod u+s chmod g+s chmod u+t – robert – 2018-07-11T10:26:38.680

Answers

2

The s-bit or sticky bit allows you to influence the execution of executables or how directories are handled. For how it works setuid is also pretty important.

The common uses are:

The most common use of the sticky bit is on directories residing within filesystems for Unix-like operating systems. When a directory's sticky bit is set, the filesystem treats the files in such directories in a special way so only the file's owner, the directory's owner, or root can rename or delete the file.

As well as:

setuid and setgid (short for "set user ID upon execution" and "set group ID upon execution", respectively) are Unix access rights flags that allow users to run an executable with the permissions of the executable's owner or group respectively and to change behaviour in directories.

So you can use it to "protect" a directory or let a user execute a program that needs elevated privileges without granting them explicitly to the user. For example you could have a script that's owned by root, has the sticky bit set and if you execute it will be executed as if you'd be root.

If you look at the man page you will find that s stand for the setuid/gid bit and t for the deletion bit.

set user or group ID on execution (s), restricted deletion flag or sticky bit (t)

See also:

Seth

Posted 2018-07-11T10:17:02.743

Reputation: 7 657

1

chmod u+s chmod g+s chmod u+t

The + operator adds a mode to a class. For example:

chmod u+s

Adds the s-mode (setuid) to the u class (the file's owner).

The Wikipedia article explains it quite well: https://en.wikipedia.org/wiki/Chmod

Also see:

info chmod
man chmod

Andreas Hartmann

Posted 2018-07-11T10:17:02.743

Reputation: 1 072