RHCSA7本地用户和组的管理

以下试题来自:

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

 

转载于:https://www.cnblogs.com/emmagikyo/p/4326182.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值