Linux 101: What’s the SUID permission?

Linux 101: What’s the SUID permission?

On this Linux 101, Jack Wallen explains the SUID permission bit.

Picture: iStockphoto/Elena Kalashnik

For those who’re new to Linux administration, you’ve got in all probability already began studying about file permissions. If I stated “drwxrwxr-x,” you’d know what that meant. It is easy: A listing with proprietor and group learn, write, execute permissions, however solely learn and execute permissions for everybody else. 

That is not the be-all, finish all for permissions. There are literally three extra permissions, considered one of which I’ll educate you about proper now. Stated permission known as SUID, which stands for Set proprietor Consumer ID. It is a particular permission that applies to scripts or functions. If the SUID bit is ready, when the command is run, it is efficient UID turns into that of the proprietor of the file, as an alternative of the person working it. 

SEE: Kubernetes safety information (free PDF) (TechRepublic)

That is used to supply short-term elevated permissions throughout execution. For instance, if the file being executed was owned by root and has the SUID bit set, irrespective of who’s working the script or utility, the permissions would all the time (quickly) equal these of root. 

One very easy-to-understand instance of that is when a person needs to vary their password they usually difficulty the sudo passwd command. If the SUID bit wasn’t set on passwd, the command can be run with out elevated privileges, and would not be capable to write to the required information to vary the password–hence the SUID bit. 

For those who create a script (owned by the foundation person) that wants the SUID bit set, you’d achieve this like: 

sudo chmod u+s filename 

The place filename is the title of the script or utility. As soon as the SUID bit is ready, anytime that utility is executed, will probably be executed with quickly elevated privileges. 

And that is the gist of the SUID permission bit. It sounds extra sophisticated than it truly is. Though you won’t use it each day, you may be glad it, once you run right into a scenario the place it is clearly obligatory.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise execs from Jack Wallen.

Additionally see

Source link