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
Account Lock/Unlock Script Generator
Generate Linux user account lock/unlock scripts and commands. Create automated scripts for managing account security, password policies, and user access control with comprehensive logging and notifications.
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>
Anacron Job Generator (Daily/Weekly/Monthly)
Generate anacron job configurations for daily, weekly, and monthly tasks. Create reliable scheduled jobs that run even when the system is offline, with support for both anacron and systemd timer alternatives.
at Command Generator
Generate precise at commands for Linux task scheduling. Schedule one-time tasks with our interactive command generator tool.
AutoMount Configuration Tool
Configure automatic mounting of filesystems and devices at boot time. Create proper fstab entries, configure udev rules, and set up systemd mount units for seamless filesystem access without manual intervention.
Bind Mount Generator
Generate bind mount configurations for chroot environments, containers, and directory overlays. Create mount commands, fstab entries, and systemd mount units with proper options for various bind mount scenarios.
Stay Updated with Linux Tips
Get weekly tutorials, command references, and new tool announcements delivered straight to your inbox.