LPIC-1 104.5: File permissions and ownership
Octal modes, execute-only directories, the umask, a shared group directory with setgid and sticky bits, and finding setuid programs.
Before you start
The lab creates /root/perm/report.txt (mode 644) and three users with
password Lab-Pass-1: tess, and anna and ben for the shared
directory. Work as root (sudo -i) unless a task says otherwise, and
write answers to the files in /root/lab-answers/.
Tasks
- Work out the octal mode for "owner reads and writes, group reads,
others nothing", apply it to
/root/perm/report.txt, and check withls -landstat -c %a. Write the mode to/root/lab-answers/1. - As root, make
/srv/testwith mode711and put a readable file in it. Astess, trylson the directory andcaton the file by its full path. - Set
umask 077, create a file/root/perm/f077and a directory/root/perm/d077, and check their modes. Do the same withumask 033for/root/perm/f033and/root/perm/d033. - Build the shared
/srv/webdirectory from the chapter for groupweb, withannaandbenas members. Withchmod 2770andumask 002, show that each user's new files get thewebgroup and that the other user can add to them (echo more >> file). Thenchmod 3770and show that neither can delete the other's files. - List the setuid and setgid programs on your system with
find, and write the list to/root/lab-answers/5.
Hints
ris 4,w2,x1;chmod,stat -c %a.mkdir -m 711;su - tess(orsudo -u tess);ls /srv/testandcat /srv/test/FILE.umaskonly affects the current shell; new files start from 666 and directories from 777.groupadd web,usermod -aG web anna;chgrp,chmod. Group membership counts from the next login. As each user,umask 002before creating a file.find / -xdev -type f -perm /6000.