首页 > 其他 > 详细

第四天作业

时间:2016-08-03 15:48:53      阅读:266      评论:0      收藏:0      [点我收藏+]

1 、创建 用户gentoo ,附加组为bin 和root ,默认shell为/bin/csh ,注释信息为"Gentoo Distribution"

useradd -G bin,root -s /bin/csh -c "Gentoo Distribution" gentoo

2 、创建 下面的用户、组和组成员关系,名字为 为admins的组

用户natasha ,使用admins  作为附属组

用户harry ,也使用admins  作为附属组

用户sarah ,不可交互登录系统, 且 不是admins的成员,natasha ,harry ,sarah 密码 都是centos

useradd -G admins natasha
useradd -G admins harry
useradd -r -s /sbin/nologin sarah
echo "centos" |passwd --stdin=natasha
echo "centos" |passwd --stdin=harry
echo "centos" |passwd --stdin=sarah

3、创建testuser uid 1234,主组:bin,辅助组:root,ftp,shell:/bin/csh home:/testdir/testuser

useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser

4、修改testuser uid:4321,主组:root,辅助组:nobody,loginname:test,home:/home/test 家数据迁移

usermod -u 4321 -g 0 -G nobody -l test -md /home/test testuser

5、批量创建帐号:user1...user10

uid:3000-3009,shell:/bin/csh,home:/testdir/username

passwd:usernamepass

注意家目录相关配置,使用户正常登录

touch users.txt
vi users.txt
newusers users.txt
touch passwd.txt
vi passwd.txt
cat passwd.txt |chpasswd
cp -r /etc/skel/.[^.]* /testdir/user1
cp -r /etc/skel/.[^.]* /testdir/user2
cp -r /etc/skel/.[^.]* /testdir/user3
cp -r /etc/skel/.[^.]* /testdir/user4
cp -r /etc/skel/.[^.]* /testdir/user5
cp -r /etc/skel/.[^.]* /testdir/user6
cp -r /etc/skel/.[^.]* /testdir/user7
cp -r /etc/skel/.[^.]* /testdir/user8
cp -r /etc/skel/.[^.]* /testdir/user9
cp -r /etc/skel/.[^.]* /testdir/user10








本文出自 “秋风夜雨” 博客,请务必保留此出处http://2849159106.blog.51cto.com/7881853/1833749

第四天作业

原文:http://2849159106.blog.51cto.com/7881853/1833749

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!