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

相关推荐

  • 推荐-BtrFS学习总结

    一、原理介绍1.可扩展性2.数据一致性的相关特性3.多设备管理及快照二、命令介绍与实战1.命令介绍2.命令实战1)环境准备,添加3块磁盘/dev/sd{b,c,d}如下:2)创建btrfs文件系统3)查看已创建的btrfs文件系统4)挂载btrfs文件系统,启用压缩功能5)在线调整文件系统大小6)往当前btrfs文件系统添加设备,以达到在线扩容扩容目的7)执…

    Linux干货 2016-06-03
  • Docker 之初次体验

    一、Docker 简介  lxc linux container,openvz  容器中各虚拟机只有一个内核,而是多个用户空间  在库中完成虚拟化,比如wine 或者在windows中运行bash  在应用程序的运行级别提供虚拟化,比如jvm   pstree , pid 为1 的进程  …

    Linux干货 2017-02-24
  • 倒排索引-搜索引擎的基石

    1.概述       在关系数据库系统里,索引是检索数据最有效率的方式,。但对于搜索引起,他它并不能满足其特殊要求:       1)海量数据:搜索引擎面对的是海量数据,像Google,百度这样大型的商业搜索引擎索引都是亿级甚至几千的网页数量 ,面对…

    Linux干货 2015-12-10
  • N26-第七周作业-邢岩

    马哥门徒-N26-邢岩      今天看了一本书《运维前线:一线运维专家的运维方法、技巧与实践》,有一张运维全平台规划体系如下:      看完这张图,瞬间觉得自动化运维真的是很庞大精深,我只是在运维这片海洋的岸边,刚刚迈入一只脚步而已,究竟什么是山,什么是水,还不得而知。就让我化身一条小鱼,在这片…

    2017-03-11
  • 马哥教育网络班21期-第1周课程练习

    1、  描述计算机的组成及其功能。 计算机由硬件系统和软件系统两部分组成。硬件系统由运算器,控制器,存储器,输入设备和输出设备组成.     运算器:计算机中进行算术运算和逻辑运算的部件。     控制器:计算机的控制中心。协调和指挥计算机系统的操作。  &n…

    Linux干货 2016-07-12
  • linux 系统基础(三)–用户和组命令使用总结

    1、列出当前系统上所有已经登录的用户名,注意:同一个用户登录多次,则只显示一次即可。 [root@node2 ~]# who   root     pts/0        2016-10-…

    Linux干货 2016-10-08