8-1作业

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

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

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

[root@localhost ~]# usermod -u 4321 -g root -G nobody -l test -md /home/test testuser
[root@localhost ~]# getent passwd test
test:x:4321:0::/home/test:/bin/csh
[root@localhost ~]# ls -a /home/test/
.  ..  .bash_logout  .bash_profile  .bashrc  .gnome2  .mozilla

3、批量创建帐号:user1…user10 uid:3000-3009,shell:/bin/csh,home:/testdir/username passwd:usernamepass 注意家目录相关配置,使用户正常登录

[root@localhost ~]# vim homework.txt
    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 ~]# newusers homework.txt
[root@localhost ~]# vim homeworkpw.txt
    user1:user1pass
    user2:user2pass
    user3:user3pass
    user4:user4pass
    user5:user5pass
    user6:user6pass
    user7:user7pass
    user8:user8pass
    user9:user9pass
    user10:user10pass
[root@localhost ~]# cat homeworkpw.txt | chpasswd
[root@localhost skel]# cp -r /etc/skel/.[^.]* /testdir/user1 
    ...将/etc/skel目录下的文件分别复制到每个用户家目录
    cp -r /etc/skel/. /testdir/user10

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

(0)
paopao
上一篇 2016-08-03 19:05
下一篇 2016-08-03 19:07

相关推荐

  • 过滤语句和复制,权限的一些事例

    1.复制/etc/skel 目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限 ~]# cp -r /etc/skel/ /home/tuser1/ ~]# chmod go= /home/tuser1/ 2.编辑/etc/group文件,添加组hadoop ~]# echo "hadoop:…

    Linux干货 2016-10-14
  • 开始学习Linux的一些建议

    建议读者范围 有开发经验者。 科研人员(由其Numrical)。 动手能力强的。 只是好奇,对于Linux只是浅尝辄止的就不建议继续往下看了。 端正学习态度 Linux不等于骇客(or Cracker)。 当然众所周知很多“黑客工具”都是Linux平台上的,我帮助过很多Linux小白发现他们殊途同归都是朝着类似Aircrack-ng去的。 但他们不知道的是:…

    Linux干货 2015-02-26
  • Linux中的包管理

    1. RPM介绍 rpm是linux中的包管理软件,通过rpm用户可以对rpm包进行查询、安装、卸载、升级和校验等操作。 1.1 查询 查询 -q:可以查看某个包是否已经安装 -qa:查看系统已经安装的所有包 -qi:查询某个安装包的详细情况 -ql:查询安装某个包之后会生成哪些文件 -qc:查询某个软件的配置文件 -qd:查询某个软件的所有文档 &#821…

    Linux干货 2017-04-17
  • lnmap实战之负载均衡架构(无高可用)

    lnmap实战之负载均衡架构(无高可用) 架构图如下: 此次实战软件,全部yum安装 1.准备好机器,同步好时间 192.168.42.150 node1 [负载均衡器]192.168.42.152 node3 [web2]192.168.42.153 node4 [web1]192.168.42.151 node2 [memcached session存储…

    Linux干货 2017-06-22
  • Linux终端类型

    Linux系统的终端主要包括控制台终端、控制终端、串口终端、伪终端、虚拟终端。 1、控制台终端(/dev/console)    在Unix系统中,计算机显示器通常被称为控制台终端。Console与虚拟终端相关联,内核将信息送到控制台终端上(/dev/console), 通过与console相关联的虚拟终端将信息显示到屏幕上。不管当前正在…

    Linux干货 2016-10-19