以下试题来自:
http://www.certdepot.net/rhel7-rhcsa-sample-exam-1/
1. Create two users: john with uid/gid equal to 2000, password 12345678 and davis with uid/gid equal to 3000, password 87654321. Make davis‘ account validity stopping in one month.
Reference answer:
# useradd -u 2000 john
# echo 12345678 | passwd --stdin john
or
# passwd john
New password: 12345678
# useradd -u 3000 davis
# echo 87654321 | passwd --stdin davis
# date -d "+1 month"
# chage -E YYYY-mm-dd davis
or
# usermod -e YYYY-mm-dd davis
# chage -l davis //show account aging information
2. Create a user account named "tony" with password “redhat” and belonging to a secondary group called “team”.
Reference answer:
# groupadd team
# useradd tony -G team
# echo redhat | passwd --stdin tony
3. Allow davis (and only davis) to get full access to john‘s home directory.
Reference answer:
# setfacl -R -m u:davis:rwx ~john
4. Create a directory named /common. Allow john and davis to share documents in the /common directory using a group called team. Both of them can read, write and remove documents from the other in this directory but any user not member of the group can’t.
Reference answer:
# mkdir /common
# groupadd team
# chgrp team /common
# chmod 2770 /common
# gpasswd -a john team
# gpasswd -a davis team
5. Create a user called tom. Create a directory named /private. Use an acl to only allow access (rwx) to tom to the private directory.
Reference answer:
# useradd tom
# echo redhat | passwd --stdin tom
# mkdir /private
# chmod 000 /private
# setfacl -m u:tom:rwx /private