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)
上一篇 2016-08-03 19:05
下一篇 2016-08-03 19:07

相关推荐

  • N25第二周博客作业

    第二周博客作业: 1、linux上的文件管理命令都有哪些,其常用的使用方法及其相关示例演示。                    有  cp  mv&nbsp…

    Linux干货 2016-12-06
  • 流编辑器Sed(Stream Edit)详解

    流编辑器Sed(Stream Edit)详解       Grep 、sed 和awk并称为文本三剑客。使用Grep就可以很好的实现文本查找的功能,而且简单有效。然而其却无法直接对其进行编辑,sed的出现便解决了这一问题。 Sed被称为流编辑器,它是一种新型的非交互式的文本编辑器,它逐行处理文件或输入,并将结…

    Linux干货 2016-08-22
  • 高可用集群部署文档

    同学们都很活跃,自己好久没写了,也动动笔,下面文章写着玩的,如有错误请联系(NET7-粤-义薄云天) 高可用集群部署文档   目录: 目录: 1 项目需求: 2 实现方式: 2 拓扑图: 3 系统及软件版本: 3 安装步骤: 4 IP分配: 4 LVS和keepalived的安装和配置: 4 LVS主配置: 4 LVS2备 配置: 7 w…

    Linux干货 2015-08-11
  • GNU awk的输出格式化和操作符

    printf命令 格式化输出:printf “FORMAT”, item1, item2, … (1) 必须指定FORMAT (2) 不会自动换行,需要显式给出换行控制符,\n (3) FORMAT中需要分别为后面每个item指定格式符 格式符:与item一一对应 %c: 显示字符的ASCII码 %d, %i: 显示十进制整数 %e, %E:显示…

    2018-01-01
  • 也许你根本不会用百度搜索

    搜索引擎可以帮助使用者在Internet上找到特定的信息,但它们同时也会返回大量无关的信息。但是如果多使用一些技巧,你将发现搜索引擎会花尽可能少的时间找到你需要的确切信息。 1.简单查询 这个就是最简单便捷的使用方式,其实也是我们大多数人平时使用百度或者其他搜索引擎的方式。比如你想查培训学校,那么你的第一反应肯定就是在百度里输入【挖掘机】【挖掘机学校】【蓝翔…

    2015-03-02
  • five

    1;显示当前系统上root, fedora或user1用户的默认shell。 #   grep "^\(root\|fedora\|user1\)" /etc/passwd #   grep -E "^(root|fedora|u…

    Linux干货 2017-01-16