Linux 101: What’s the SUID permission?
On this Linux 101, Jack Wallen explains the SUID permission bit.
In case you’re new to Linux administration, you have in all probability already began studying about file permissions. If I mentioned “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, one in every of which I will train you about proper now. Mentioned permission is named SUID, which stands for Set proprietor Person ID. This can be a particular permission that applies to scripts or purposes. If the SUID bit is about, when the command is run, it is efficient UID turns into that of the proprietor of the file, as an alternative of the consumer operating it.
SEE: Kubernetes safety information (free PDF) (TechRepublic)
That is used to offer 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 operating the script or software, the permissions would at all times (briefly) equal these of root.
One very easy-to-understand instance of that is when a consumer desires to alter their password they usually problem the sudo passwd command. If the SUID bit wasn’t set on passwd, the command could be run with out elevated privileges, and would not be capable to write to the mandatory recordsdata to alter the password–hence the SUID bit.
In case you create a script (owned by the foundation consumer) that wants the SUID bit set, you’d achieve this like:
sudo chmod u+s filename
The place filename is the identify of the script or software. As soon as the SUID bit is about, anytime that software is executed, it will likely be executed with briefly 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 daily, you may be glad you already know it, while you run right into a state of affairs the place it is clearly vital.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the newest tech recommendation for enterprise professionals from Jack Wallen.