For this lab, you'll just put together everything that you've learned in this chapter to create a shared directory for a group. You can do this on either of your virtual machines:
- On either virtual machine, create the sales group:
sudo groupadd sales
- Create the users Mimi, Mr. Gray, and Mommy, adding them to the sales group as you create the accounts.
On the CentOS VM, do:
sudo useradd -G sales mimi
sudo useradd -G sales mrgray
sudo useradd -G sales mommy
On the Ubuntu VM, do:
sudo useradd -m -d /home/mimi -s /bin/bash -G sales mimi
sudo useradd -m -d /home/mrgray -s /bin/bash -G sales mrgray
sudo useradd -m -d /home/mommy -s /bin/bash -G sales mommy
- Assign each user a password.
- Create the sales directory in the root level of the filesystem. Set proper ownership and permissions, including the SGID and sticky bits:
sudo mkdir /sales
sudo chown nobody:sales /sales
sudo chmod 3770 /sales
ls -ld /sales
- Log in as Mimi, and have her create a file:
su - mimi
cd /sales
echo "This file belongs to Mimi." > mimi_file.txt
ls -l
- Have Mimi set an ACL on her file, allowing only Mr. Gray to read it. Then, have Mimi log back out:
chmod 600 mimi_file.txt
setfacl -m u:mrgray:r mimi_file.txt
getfacl mimi_file.txt
ls -l
exit
- Have Mr. Gray log in to see what he can do with Mimi's file. Then, have Mr. Gray create his own file and log back out:
su - mrgray
cd /sales
cat mimi_file.txt
echo "I want to add something to this file." >>
mimi_file.txt
echo "Mr. Gray will now create his own file." >
mr_gray_file.txt
ls -l
exit
- Mommy will now log in and try to wreak havoc by snooping in other users' files, and by trying to delete them:
su - mommy
cat mimi_file.txt
cat mr_gray_file.txt
rm -f mimi_file.txt
rm -f mr_gray_file.txt
exit
- End of Lab.