setfacl
Charles Parker Jr. is a genius with an IQ somewhere north of 150. He leads his jazz quintet by night (in which he plays the alto saxophone), and is the Director of Global Engineering at Google by day. Today is Monday September 17th, and Charlie Parker has memorized every single Linux command, and every associate flag, during his 20 minute lunch break. Assume the following:
- He works on a modern RHEL system.
- He never runs a comand as root.
- He doesn't have a lot of free time during his 1 hour lunch break because he ALWAYS practices his saxophone for 40 minutes during lunch.
- Today, in the 40 minutes that he has left, instead of practicing his saxophone, he in going to organize and set permissions on the 400 jazz songs that he is going to memorize in 20 minutes tomorrow.
- His username on his RHEL system is charlie_bird_parker_jr.
- His home directory is /home/charlie_bird_parker_jr.
- His keeps his songs in two subdirectories within his home directory: /memorized and /not_memorized.
- Currently the not_memorized directory is full of the 400 files that he need to memorize at lunch tomorrow.
- First task: he likes to memorize songs in alphabetical order. Find all of the songs that start with "A" and put their titles into a text file in his home directory called start_with_A.txt.
- He wants to review the songs with his friend Thelonious who works in the Search Department. Thelonious does not normally have access to start_with_A.txt, but Charles (Thelonious calls him "Bird") needs read-write access to it.
- Once all of the songs starting with A are read, he needs to move them to memorized.
- Please show all of the commands that Charles "Bird" Parker will execute. Assume that Thelonious' username is jazz_pianist1@google.com.
- To find all the songs that start with "A" and put their titles into a text file called start_with_A.txt in his home directory, Charles will use the following command:
- $ ls /home/charlie_bird_parker_jr/not_memorized/A* > /home/charlie_bird_parker_jr/start_with_A.txt
- This command will list all the files in the /not_memorized directory that start with "A" and redirect the output to a text file called start_with_A.txt in his home directory.
- To give Thelonious read-write access to the start_with_A.txt file, Charles will use the following command:
- $ setfacl -m u:jazz_pianist1@google.com:rw /home/charlie_bird_parker_jr/start_with_A.txt
- To move all the songs starting with A from /not_memorized to /memorized directory, Charles will use the following command:
- $ mv /home/charlie_bird_parker_jr/not_memorized/A* /home/charlie_bird_parker_jr/memorized/
This command will move all the files in the /not_memorized directory that start with "A" to the /memorized directory.