Recall & Review
beginner
What does the setuid permission do on a Linux executable file?
The setuid permission allows a user to run the executable with the file owner's permissions, not the user's own permissions. This is often used to allow normal users to run programs with elevated privileges safely.
Click to reveal answer
intermediate
How does the setgid permission affect files and directories?
For files, setgid makes the program run with the group ID of the file's group. For directories, new files created inside inherit the directory's group instead of the user's primary group.
Click to reveal answer
beginner
What is the purpose of the sticky bit on a directory?
The sticky bit on a directory restricts file deletion inside it. Only the file owner, directory owner, or root can delete or rename files, even if others have write permission on the directory.
Click to reveal answer
beginner
How can you set the setuid permission on a file using chmod?
Use the command:
chmod u+s filename. This adds the setuid bit to the file's permissions.Click to reveal answer
advanced
What does the permission string
rwsr-sr-t indicate?It shows a file with setuid (s in user execute), setgid (s in group execute), and sticky bit (t in others execute) all set. This means the file runs with owner and group privileges, and the sticky bit is active on the directory or file.
Click to reveal answer
What does the setuid bit do when set on an executable file?
✗ Incorrect
The setuid bit makes the executable run with the file owner's permissions, allowing privilege escalation in a controlled way.
What effect does the sticky bit have on a directory?
✗ Incorrect
The sticky bit restricts file deletion inside the directory to the file owner, directory owner, or root.
How do you set the setgid bit on a directory named 'shared'?
✗ Incorrect
The setgid bit is set with 'chmod g+s' on the directory.
If a directory has setgid set, what happens to new files created inside?
✗ Incorrect
Setgid on a directory causes new files to inherit the directory's group ownership.
Which command shows special permissions like setuid, setgid, and sticky bit in the file listing?
✗ Incorrect
The 'ls -l' command shows permissions, and special bits appear as 's' or 't' in the permission string.
Explain what setuid, setgid, and sticky bit permissions do in Linux and give a real-life example for each.
Think about who can run or delete files and with what permissions.
You got /4 concepts.
Describe how to set and verify the sticky bit on a directory and why it might be useful.
Focus on commands and the purpose of sticky bit in shared spaces.
You got /4 concepts.