setfacl

Demea is a Master Linux Sysadmin at Red Hat. She has a multi-part task in from of her.

  1. Angela Davis is a new Red Hat employee. She needs an account on the main RHEL server with this username angela.y.davis@redhat.com.
  2. Angela's shell should be /bin/zsh and her custom home directory should be /home/angelad. He Gecos field should be "Angela Y. Davis - Engineering Dept.".
  3. Demea must create a new file outside of Angela Home Directory in /home/new_employees/new_employees_log.txt and create a new group called new_employees, and give it read-write access to the file.
  4. Demea must then make Angela a part of that group.
  5. Finally Demea must create a new file in /home/angelad called angelas_notes.txt and copy the ACL from new_employees_log.txt to angelas_notes.txt using getfacl and setfacl.

Please list all of the commands that Demea must run. Note: Demea is a highly seasoned Linux Sysdamin, so she NEVER runs commands as root.

Sure, here are the commands that Demea can run to complete the multi-part task:

  1. Create a new user account for Angela Davis:
    • sudo useradd -m -s /bin/zsh -d /home/angelad -c "Angela Y. Davis - Engineering Dept." angela.y.davis@redhat.com
    • This command creates a new user account with the specified shell, custom home directory, and GECOS field.
  2. Create a new file outside of Angela's home directory and give the new_employees group read-write access to it:
    • sudo touch /home/new_employees/new_employees_log.txt
      sudo chgrp new_employees /home/new_employees/new_employees_log.txt
      sudo chmod g+rw /home/new_employees/new_employees_log.txt
    • These commands create a new file and change its group ownership to new_employees. Then, they add read and write permissions to the new_employees group.
  3. Add Angela Davis to the new_employees group:
  4. Create a new file in Angela Davis's home directory and copy the ACL from new_employees_log.txt to angelas_notes.txt:
    • sudo touch /home/angelad/angelas_notes.txt
      sudo getfacl /home/new_employees/new_employees_log.txt | sudo setfacl --set-file=- /home/angelad/angelas_notes.txt

These commands create a new file in Angela Davis's home directory, and then use getfacl to obtain the ACL from new_employees_log.txt, and then setfacl to copy the ACL to angelas_notes.txt.

After running these commands, Angela Davis should have a new user account with the specified shell and home directory. She should also have read-write access to the file /home/new_employees/new_employees_log.txt, along with any other users in the new_employees group. Finally, Angela Davis should have a new file in her home directory called angelas_notes.txt with the same ACL as new_employees_log.txt.

You should also read:

setfacl

Charlie "Bird" Parker is a genius-level jazz alto saxophonist. He has just read a book about setfacl, in fact he memorized the entire…

setfacl

Charles Parker Jr. is a genius with an IQ somewhere north of 150. He leads his jazz quintet by night (in which he…

setfacl

Andre is a new employee at Red Hat who is struggling with copying ACLs from one file to another using getfacl and setfacl…

setfacl

Hosaac S. is the new Director of IT at Microsoft. He Learns that GNU/Linux Team is relatively weak of the use of the…