Shared Folders and Dangerous Bits
Two jobs today. The crew needs a shared folder where everyone in the crew group can work, but nobody can delete other people's files. And a security scan flagged something odd in /opt/tools. Your password for sudo is student.
How it works: the terminal below is a real Linux machine running in your browser. Click it and
type. Tasks tick themselves off as you complete them; questions are answered in the box under each task.
Press Reset any time for a fresh machine. Your password on this machine (for
sudo) is student.
Hints
ls -ld /srv/crew-share and ls -l /opt/tools show the special bits as s and t.
Solution explanation
chmod g+w,g+s,+t (or chmod 3775) gives the group write access, the SGID bit and the sticky bit in one go: ls -ld then shows drwxrwsr-t. In /opt/tools, helper answers --version like bash, because it is a SUID root copy of it: anyone could run /opt/tools/helper -p and get a root shell. chmod u-s closes that door.
Show solution
sudo chgrp crew /srv/crew-share
sudo chmod g+w,g+s,+t /srv/crew-share
ls -ld /srv/crew-share
find /opt/tools -perm -4000
/opt/tools/helper --version
sudo chmod u-s /opt/tools/helper