Setuid/Setgid Demonstrator
<p>A Linux tool to visualize and understand setuid and setgid bits and their effect on file and directory permissions.</p>
Setuid/Setgid Demonstrator
chmod
What are setuid and setgid?
setuid and setgid are special permission bits in Unix/Linux systems. When set on an executable file, setuid allows the file to run with the permissions of the file's owner, and setgid allows it to run with the permissions of the file's group. When set on a directory, setgid causes new files and subdirectories to inherit the group of the directory.
How to Recognize setuid/setgid
In a directory listing (ls -l), setuid and setgid appear as s
or S
in the execute position for owner and group:
s
: Execute and setuid/setgid are set (e.g.,-rwsr-xr-x
or-rwxr-sr-x
)S
: setuid/setgid is set, but execute is not (e.g.,-rwSr-xr-x
or-rwxr-Sr-x
)
Setting setuid/setgid
To set setuid on a file:
To set setgid on a file or directory:
Or numerically (the leading 4
sets setuid, 2
sets setgid):
Where are setuid/setgid Used?
- setuid is commonly used for programs that need root privileges, like
passwd
. - setgid is often used on directories for collaborative group access.
Related Tools
ACL Permission Generator (getfacl/setfacl)
<p>A Linux tool to generate getfacl and setfacl commands for managing Access Control Lists (ACLs) on files and directories.</p>
Chmod Calculator
Calculate file permissions in Linux using a visual interface
Chown Command Generator
<p>A Linux tool to easily generate chown commands for changing file ownership between users and groups</p>
Crontab Generator
Generate cron expressions for scheduled tasks
Docker Volume Permission Helper
<p>A tool to help resolve permission issues between Docker containers and host system volumes with proper user/group mappings.</p>
Effective Permission Calculator (User + Group + Others)
<p>A Linux tool to calculate the effective permissions for a user, considering user, group, and others permissions.</p>
Stay Updated with Linux Tips
Get weekly tutorials, command references, and new tool announcements delivered straight to your inbox.