系统基础之用户,组管理作业题

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

1
2
3
[root@wen-7 ~]# useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser
[root@wen-7 ~]# getent passwd testuser 
testuser:x:1234:1::/testdir/testuser:/bin/csh

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

1
2
3
[root@wen-7 ~]# usermod -l test -u 4321 -g root -G nobody -d /home/test -m  testuser
[root@wen-7 ~]# getent passwd test
test:x:4321:0::/home/test:/bin/csh


3、批量创建帐号:user1…user10

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

passwd:usernamepass

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[root@w6 ~]# mkdir /testdir
[root@w6 ~]# cat  user.sh 
user1:x:3001:3001::/testdir/user1:/bin/csh
user2:x:3002:3002::/testdir/user2:/bin/csh
user3:x:3003:3003::/testdir/user3:/bin/csh
user4:x:3004:3004::/testdir/user4:/bin/csh
user5:x:3005:3005::/testdir/user5:/bin/csh
user6:x:3006:3006::/testdir/user6:/bin/csh
user7:x:3007:3007::/testdir/user7:/bin/csh
user8:x:3008:3008::/testdir/user8:/bin/csh
user9:x:3009:3009::/testdir/user9:/bin/csh
user10:x:3010:3010::/testdir/user10:/bin/csh
[root@w6 ~]# newusers user.sh 
[root@w6 ~]# tail -10 /etc/passwd
user1:x:3001:3001::/testdir/user1:/bin/csh
user2:x:3002:3002::/testdir/user2:/bin/csh
user3:x:3003:3003::/testdir/user3:/bin/csh
user4:x:3004:3004::/testdir/user4:/bin/csh
user5:x:3005:3005::/testdir/user5:/bin/csh
user6:x:3006:3006::/testdir/user6:/bin/csh
user7:x:3007:3007::/testdir/user7:/bin/csh
user8:x:3008:3008::/testdir/user8:/bin/csh
user9:x:3009:3009::/testdir/user9:/bin/csh
user10:x:3010:3010::/testdir/user10:/bin/csh         
[root@w6 ~]# cat passwd.sh |chpasswd 
[root@w6 ~]# cat passwd.sh 
user1:user1pass
user2:user2pass
user3:user3pass
user4:user4pass
user5:user5pass
user6:user6pass
user7:user7pass
user8:user8pass
user9:user9pass
user10:user10pass
 
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user1
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user2
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user3
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user4
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user5
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user6
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user7
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user8
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user9
[root@w6 ~]# cp -r /etc/skel/.[^.]* /testdir/user10
[root@w6 ~]# ll -a /testdir/user1
total 32
drwx------.  4 user1 user1 4096 Jul 30 16:58 .
drwxr-xr-x. 12 root  root  4096 Jul 30 16:53 ..
-rw-r--r--.  1 root  root    18 Jul 30 16:58 .bash_logout
-rw-r--r--.  1 root  root   176 Jul 30 16:58 .bash_profile
-rw-r--r--.  1 root  root   124 Jul 30 16:58 .bashrc
drwxr-xr-x.  2 root  root  4096 Jul 30 16:58 .gnome2
-rw-------.  1 user1 user1   53 Jul 30 16:56 .history
drwxr-xr-x.  4 root  root  4096 Jul 30 16:58 .mozilla
[root@w6 ~]# ll -a /testdir/user2

原创文章,作者:wencx,如若转载,请注明出处:http://www.178linux.com/27639

(0)
wencxwencx
上一篇 2016-08-04 14:42
下一篇 2016-08-04 14:42

相关推荐

  • linux发展史

    通过本篇文章,读者可以了解Linux的基本概念、历史、发展情况; 首先,我们通过简单的介绍Linux,了解什么是linux以及它的发展背景; 前言:操作系统介绍 内核负责控制硬件资源分配,而如果只有内核,则只能让计算机硬件运行,而不能有任何功能,因此需要系统调用提供给开发者使用,从而开发应用程序; 内核能够控制硬件,比如:让CPU可以运算、让硬盘可以读写数据…

    Linux干货 2016-10-14
  • 实验:配置静态路由2

    实验:配置静态路由2 IP地址规划如下: VMware实验环境下给网卡分配不同的VMnet以实现物理分隔广播域: Client1-VMnet1: R1-VMnet1-VMnet2: R2-VMnet2-VMnet3: R3-VMnet3-VMnet4: Client2-VMnet4: 注意,环境准备: 1、MAC地址不要有冲突,如果是复制的虚拟机,对于cen…

    2017-03-26
  • 学习宣言

    如果自己都不愿意动,没有人能帮助我成功!

    Linux干货 2016-12-26
  • Proxmox-Linux下的开源管理平台

    1)proxmox简介 Proxmox VE (Proxmox Virtual Environment) 是一个非常棒的集成OPENVZ 支持KVM应用的环境。有方便易用的WEB界面,基于JAVA的UI和内核接口,可以登录到VM客户方便的操作,还有易用的模板功能,基本跟老外的商业VPS环境差不多了,支持VT和ISCSI 2)proxmox的安装与基本配置 安…

    Linux干货 2016-08-08
  • 链接分析算法之:HillTop算法

       Hilltop算法是由Krishna Baharat 在2000年左右研究的,于2001年申请专利,但是有很多人以为Hilltop算法是由谷歌研究的。只不过是Krishna Baharat 后来加入了Google成为了一名核心工程师,然后授权给Google使用的。     &nbsp…

    大数据运维 2015-04-08
  • 15-2用户系统资源配额

    用户资源系统配额 在系统中,允许系统用户使用存储空间,但是不能限制的让用户随意使用存储空间,对用户存储空间的设定就是用户资源系统配额。 下面以/home 为例,通常如果系统中有一定的用户,会把用户的家目录作为一个单独的分区,从而实现更好的管理。下面具体讲解如何把用户家目录从根系统分区分离出来进行磁盘配额。 1、拿出一个未使用的分区,把用户家目录的数据拷贝到新…

    Linux干货 2016-12-02