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
chmodWhat 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-xor-rwxr-sr-x)S: setuid/setgid is set, but execute is not (e.g.,-rwSr-xr-xor-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.
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.
Command Retry Cron Generator
Create cron jobs with intelligent retry logic and exponential backoff for failed commands. Generate retry scripts, systemd timers, and cron entries with configurable retry strategies.
Scheduler with Random Delay Generator
Generate cron schedules with random delays to prevent thundering herd problems. Add jitter to your scheduled jobs.
Scheduler for Holiday-Safe Execution (skip weekends/holidays)
Create cron schedules that automatically skip weekends and holidays. Generate business-day-only scheduling expressions.
Timezone Cron Adjuster (convert job to UTC)
Convert cron expressions between different timezones. Adjust scheduled jobs for UTC or other timezone requirements.
Stay Updated with Linux Tips
Get weekly tutorials, command references, and new tool announcements delivered straight to your inbox.