setfacl
Adrea is a RHEL Sysdadmin who has been tasked with the following:
- Create a group named developers.
- Create a new user name marquisj to the group. Marquis should have the default home directory and /bin/bash as his shell.
- Create a new directory named /home/developers/mydocs.
- Give the group developers read-only access to mydocs (using setfacl command).
- Give Marquis read-write access to mydocs (using setfacl command).
- Give all others no access to mydocs (using setfacl command).
Here are the commands that Adrea can use to complete the task:
- Create the developers group:
- sudo groupadd developers
- Create the new user Marquis and add him to the developers group:
- sudo useradd -m -s /bin/bash -G developers marquisj
- Create the new directory and set the owner to Marquis and the group to developers:
- sudo mkdir /home/developers/mydocs
- sudo chown marquisj:developers /home/developers/mydocs
- Give the group developers read-only access to mydocs using
setfacl
command:- sudo setfacl -m g:developers:r /home/developers/mydocs
- Give Marquis read-write access to mydocs using
setfacl
command:- sudo setfacl -m u:marquisj:rw /home/developers/mydocs
- Give all others no access to mydocs using
setfacl
command:- sudo setfacl -m o::--- /home/developers/mydocs
With these commands, Adrea has created the developers group, added the user Marquis to the group, created a new directory with the appropriate permissions, and used the setfacl
command to give the developers group read-only access to the directory, Marquis read-write access, and all others no access.