练习1
创建用户gentoo,附加组为bin和root,默认shell为 /bin/csh,注释信息为”Gentoo Distribution”
|
1
2
3
|
[root❄centos7 skel]☭ useradd gentoo -G bin,root -s /bin/csh -c "Gentoo Distribution"
[root❄centos7 skel]☭ cat /etc/passwd |grep gentoo
gentoo:x:1001:1001:Gentoo Distribution:/home/gentoo:/bin/csh
|
练习2
创建下面的用户、组和组成员关系
名字为admins 的组
用户natasha,使用admins 作为附属组
用户harry,也使用admins 作为附属组
用户sarah,不可交互登录系统,且不是admins 的成员, natasha,harry,sarah密码都是centos
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[root❄centos7 skel]☭ groupadd admins
[root❄centos7 skel]☭ useradd natasha -G admins
[root❄centos7 skel]☭ useradd harry -G admins
[root❄centos7 skel]☭ useradd sarah -s /sbin/nologin
[root❄centos7 skel]☭ echo centos | passwd --stdin natasha
Changing password for user natasha.
passwd: all authentication tokens updated successfully.
[root❄centos7 skel]☭ echo centos | passwd --stdin harry
Changing password for user harry.
passwd: all authentication tokens updated successfully.
[root❄centos7 skel]☭ echo centos | passwd --stdin sarah
Changing password for user sarah.
passwd: all authentication tokens updated successfully.
[root❄centos7 skel]☭ tail -n 3 /etc/passwd
natasha:x:1002:1003::/home/natasha:/bin/bash
harry:x:1003:1004::/home/harry:/bin/bash
sarah:x:1004:1005::/home/sarah:/sbin/nologin
|
转载于:https://www.cnblogs.com/momenglin/p/8532538.html
最后
以上就是淡定台灯最近收集整理的关于用户和组的练习题的全部内容,更多相关用户和组内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复