groupadd
Ptah is the Director of Engineering at Google. He needs to give group and individual permissions on a RHEL system.
Ptah feels that it is very inscure to run commands as root, so he always uses sudo.
He needs to create the group new_engineers and give them read-only access to all of the documents in /home/new_engineers/read_these_first , a directory which does not yet exist on his system.
He needs to create accounts for the following users, and make new_engineers their primary group (all users will have the username lastnamefirstinitial, for example Tate Brasdshaw should be bradshawt):
- Tate Bradshaw
- Tashawna Hall
- Christian McBride
- Jaleel Shaw
- Christina Aguilera
All 5 should also be added to the secondary group new_hires, which willl need to be created.
Finally, all 5 need read-write access to /home/new_hires/weekly_journal.txt, which has not yet been created yet.
Please show all commands Ptah will need to execute to make all of this happen.
- Create new group new_engineers:
- sudo groupadd new_engineers
- Create new group new_hires:
- sudo groupadd new_hires
- Create the directory /home/new_engineers/read_these_first:
- sudo mkdir -p /home/new_engineers/read_these_first
- Grant read-only access to the new_engineers group:
- sudo chmod -R 440 /home/new_engineers/read_these_first
sudo chgrp -R new_engineers /home/new_engineers/read_these_first
- sudo chmod -R 440 /home/new_engineers/read_these_first
- Create user accounts with the following usernames and make new_engineers their primary group:
- Tate Bradshaw:
- sudo useradd -m -g new_engineers -G new_hires -s /bin/bash bradshawt
- Tashawna Hall:
- sudo useradd -m -g new_engineers -G new_hires -s /bin/bash hallt
- Christian McBride:
- sudo useradd -m -g new_engineers -G new_hires -s /bin/bash mcbridec
- Jaleel Shaw:
- sudo useradd -m -g new_engineers -G new_hires -s /bin/bash shawjaleel
- Christina Aguilera:
- sudo useradd -m -g new_engineers -G new_hires -s /bin/bash aguilerac
- Tate Bradshaw:
- Create the file /home/new_hires/weekly_journal.txt:
- sudo touch /home/new_hires/weekly_journal.txt
- Grant read-write access to the new_hires group for the file /home/new_hires/weekly_journal.txt:
- sudo chmod 660 /home/new_hires/weekly_journal.txt
sudo chgrp new_hires /home/new_hires/weekly_journal.txt
- sudo chmod 660 /home/new_hires/weekly_journal.txt
Note: Ptah will need to set the passwords for each user separately using the command sudo passwd username
after creating their accounts.