8.1用户及组管理作业
2016-08-02 14:03
134 查看
1、创建testuser uid 1234,主组:bin,辅助组:root,ftp,shell:/bin/csh home:/testdir/testuser
ginname:test,home:/home/test 家数据迁移
uid:3000-3009,shell:/bin/csh,home:/testdir/username
passwd:usernamepass
注意家目录相关配置,使用户正常
登录
1、创建用户gentoo,附加组为bin和root,默认shell为/bin/csh,注释信息为"Gentoo Distribution"
名字为admins 的组
用户natasha,使用admins 作为附属组
用户harry,也使用admins 作为附属组
用户sarsh,不可交互登录系统,且不是admins 的成员,
natasha,harry,sarsh密码都是centos
[root@qzx ~]# useradd testuser -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser [root@qzx ~]# getent passwd testusertestuser:x:1234:1::/testdir/testuser:/bin/csh [root@qzx ~]# groups testuser testuser : bin root ftp2、修改testuser uid:4321,主组:root,辅助组:nobody,lo
ginname:test,home:/home/test 家数据迁移
[root@qzx ~]# usermod testuser -u 4321 -g root -G nobody,loginname,test -md /home/test [root@qzx ~]# getent passwd testusertestuser:x:4321:0::/home/test:/bin/csh [root@qzx ~]# groups testusertestuser : root nobody loginname test3、批量创建帐号:user1...user10
uid:3000-3009,shell:/bin/csh,home:/testdir/username
passwd:usernamepass
注意家目录相关配置,使用户正常
登录
首先创建用户文件和密码文件 [root@localhost ~]# cat cat catchsegv catman [root@localhost ~]# cat textuser.test user1:x:3000:3000::/testdir/user1:/bin/csh user2:x:3001:3001::/testdir/user2:/bin/csh user3:x:3002:3002::/testdir/user3:/bin/csh user4:x:3003:3003::/testdir/user4:/bin/csh user5:x:3004:3004::/testdir/user5:/bin/csh user6:x:3005:3005::/testdir/user6:/bin/csh user7:x:3006:3006::/testdir/user7:/bin/csh user8:x:3007:3007::/testdir/user8:/bin/csh user9:x:3008:3008::/testdir/user9:/bin/csh user10:x:3009:3009::/testdir/user10:/bin/csh [root@localhost ~]# cat passwd.text user1:user1passwd user2:user2passwd user3:user3passwd user4:user4passwd user5:user5passwd user6:user6passwd user7:user7passwd user8:user8passwd user9:user9passwd user10:user10passwd 批量创建用户 [root@localhost ~]# newusers textuser.test 批量改密码 [root@localhost ~]# cat passwd.text | chpasswd 复制家目录相关配置 [root@localhost ~]# cp -a /etc/skel/. /testdir/user1 [root@localhost ~]# cp -a /etc/skel/. /testdir/user2 [root@localhost ~]# cp -a /etc/skel/. /testdir/user3 [root@localhost ~]# cp -a /etc/skel/. /testdir/user4 [root@localhost ~]# cp -a /etc/skel/. /testdir/user5 [root@localhost ~]# cp -a /etc/skel/. /testdir/user6 [root@localhost ~]# cp -a /etc/skel/. /testdir/user7 [root@localhost ~]# cp -a /etc/skel/. /testdir/user8 [root@localhost ~]# cp -a /etc/skel/. /testdir/user9 [root@localhost ~]# cp -a /etc/skel/. /testdir/user10 切换用户 [user1@localhost ~]$ su - user2 密码: [user2@localhost ~]$ ls -al 总用量 16 drwx------. 3 user2 user2 74 8月 2 13:56 . drwxr-xr-x. 12 root root 4096 8月 2 13:30 .. -rw-r--r--. 1 user2 user2 18 8月 2 13:56 .bash_logout -rw-r--r--. 1 user2 user2 193 8月 2 13:56 .bash_profile -rw-r--r--. 1 user2 user2 231 8月 2 13:56 .bashrc drwxr-xr-x. 4 user2 user2 37 8月 2 13:56 .mozilla上课练习
1、创建用户gentoo,附加组为bin和root,默认shell为/bin/csh,注释信息为"Gentoo Distribution"
[root@qzx ~]# useradd gentoo -G bin,root -s /bin/csh -c "Gentoo Distribtion" [root@qzx ~]# groups gentoo gentoo : gentoo root bin [root@qzx ~]# getent passwd gentoo gentoo:x:4323:4323:Gentoo Distribtion:/home/gentoo:/bin/csh2、创建下面的用户、组和组成员关系
名字为admins 的组
用户natasha,使用admins 作为附属组
用户harry,也使用admins 作为附属组
用户sarsh,不可交互登录系统,且不是admins 的成员,
natasha,harry,sarsh密码都是centos
[root@qzx ~]# groupadd admins [root@qzx ~]# useradd natasha -G admins [root@qzx ~]# useradd harry -G admins [root@qzx ~]# useradd sarsh -s /sbin/nologin [root@qzx ~]# getent passwd sarsh sarsh:x:4326:4327::/home/sarsh:/sbin/nologin [root@qzx ~]# echo "centos"|passwd --stdin natasha Changing password for user natasha. passwd: all authentication tokens updated successfully. [root@qzx ~]# echo "centos"|passwd --stdin harry Changing password for user harry. passwd: all authentication tokens updated successfully. [root@qzx ~]# echo "centos"|passwd --stdin sarah passwd: Unknown user name 'sarah'. [root@qzx ~]# echo "centos"|passwd --stdin sarsh Changing password for user sarsh. passwd: all authentication tokens updated successfully.
相关文章推荐
- 操作系统课堂笔记(3)用户接口和作业管理
- J2ME作业,手机用户管理系统
- 操作系统(2)——用户接口与作业管理
- 用SQL SERVER 触发器+作业 实现用户积分的透明管理
- python作业之用户管理程序
- python作业(用户基本管理)
- JSP用户管理系统【上学应付作业用】
- 2015.8.25作业(练习):用户管理各命令的使用
- 2015年08月25日作业-Linux用户和组管理
- 实验楼 Linux 基础入门 用户及文件权限管理 作业笔记
- 8.1_Linux管道的使用和用户管理
- linux学习入门1——bash命令基本操作(linuxcast.net)(bash部分快捷键、uname、history、通配符、切换用户、作业管理(前台、后台运行,暂停等操作))
- linux学习入门2-3——bash命令基本操作(linuxcast.net)(bash部分快捷键、uname、history、通配符、切换用户、作业管理(前台、后台运行,暂停等操作))
- 用SQL SERVER 触发器+作业 实现用户积分的透明管理
- JSP+Servlet培训班作业管理系统[13] -使用基于Action的后端(用户登录为例)
- JSP+Servlet培训班作业管理系统[4]-记录登录用户信息
- 系统基础之用户管理作业题
- 用户管理--作业
- 用SQL SERVER 触发器+作业 实现用户积分的透明管理
- 操作系统课堂笔记(3)用户接口和作业管理