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

相关推荐

  • python快速入门之数据类型

        Python 是 90 年代初由 Guido Van Rossum 为了打发圣诞节而创建的语言。如今它已是当前最流行的程序语言之一.     Python的关键要素有以下几点:1.基本数据类型;2.对象引用;3.组合数据类型;4.逻辑操作符;5.控制流语句;6.算数操作符…

    Python干货 2015-12-10
  • 基于mysql数据库的日志分析系统

    现如今,日志已经成为了我们分析系统及相关服务的一个重要工具。而日志也具有其相对较为固定的格式以便于进行统计查询。其大致格式如下: 日期时间            主机      &…

    Linux干货 2016-10-23
  • 马哥教育网络班21期+第七周博客作业

    1、创建一个10G分区,并格式为ext4文件系统;    (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl;    (2) 挂载至datamydata目录,要求挂载时禁止程序自动运行,且不更新文件的访问时间戳 [root@ns1 ~]# m…

    Linux干货 2016-08-24
  • SUID_SGID_Sticky简单总结

    参考: http://blog.chinaunix.net/uid-25314474-id-3313109.html —————————————权限——&#82…

    Linux干货 2015-09-14
  • bash脚本之练习

    1、编写服务脚本/root/bin/testsrv.sh,完成如下要求  (1) 脚本可接受参数:start, stop, restart, status  (2) 如果参数非此四者之一,提示使用格式后报错退出 (3) 如是start:则创建/var/lock/subsys/SCRIPTNAME, 并显示“启动成功” 考虑:如果事先已经启…

    Linux干货 2016-08-24
  • 马哥教育第20期一班第一周作业

    一、利用echo将下图弄成闪烁;字体自带颜色且有下滑线? [root@centos7 ~]# echo -e "\033[31m\033[4m\033[5m\0052\0052\0052\0052\0052\0052\0052\n \0052\0052\0052\0052\0052\n &…

    Linux干货 2016-07-29