RHCSA – Exam objectives – User and Directory permissions
One of the RHCSA exam objectives is to share a directory among
users and setting up right permissions.
Scenario
Configure the following users for RHEL: nancy, randy, donna,
and mike. Make nancy and randy part of a group named angels. Create a
/home/angels directory and allow them to share files without having to change
permissions or ownership on any file they put in this directory. Do not give
donna or mike read privileges on this directory
Solution
1.
Create a directory ‘angels’ under home directory
#mkdir /home/angels
2.
Create 4 users nancy, randy, donna and mike
#useradd nancy; useradd randy; useradd
donna; useradd mike
3.
Create a group called angels and add users nancy
and randy.
#groupadd angles
#usermod –G angels nancy; usermod –G angels
randy
Or edit /etc/group and add users nancy, randy to group angels.
4.
Change permissions on directory /home/angels
#chmod -R 2770 /home/angels
#chown –R nobody:angles /home/angels
#ls –lh /home/angels
drwxrws---.
2 nobody angels 4.0K Feb 13 10:01 angels
The directory permissions are now changed
to group ‘angels’ and owner is changed to ‘nobody’. Group users other than ‘angels’
cant’ get access to /home/angels directory
5.
Test the scenario
Under user randy create a file named
test_file in /home/angles directory
If you cannot create a file, then there may
a issue with permissions. Check /home directory permissions.
Test with user randy.
Login to nancy account, and open the file
created by user nancy. Any error means group permissions are not properly set. Check
/etc/group file and look for group angels.
Nancy can also edit/write the same file
Users donna and mike shouldn’t get access to
directory /home/angels
Both users must get deny messages.
No comments:
Post a Comment