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
下一篇 2016-08-03

相关推荐

  • 文件相关操作练习

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限: 2、编辑/etc/group文件,添加组hadoop: 3、手动编辑/etc/passwd文件新增一行,添加用户hadoop,其基本组ID为hadoop组的id号;其家目录为/home/hadoop: 4、复制/etc/sk…

    2017-11-17
  • LINUX课堂笔记(第二周)

    2018.03.12 rpm httpd*** service httpd start ab 模仿用户访问 cat /var/log/httpd/access_log curl 访问web服务 rev 字符颠倒显示 sort  -r 执行反方向(由上至下)整理  -R 随机排序  -n 执行按数字大小整理  -f 选项忽略(fold)字符串中的字符大…

    Linux干货 2018-03-17
  • LVS实现负载均衡wordpress

    项目构建: LVS实现基于https wordpress 组建 必需软件: nfs-utils-1.2.3-70.el6.x86_64 配置步骤: 1.在D主机设置NFS共享目录 /app/nfsdata #mkdir /app/nfsdata //最好用LVM 实现在线扩展 #chown mysql: /app/data //确认该主机mysql用户存在 …

    2017-05-12
  • 第七周作业,分区格式化及一些脚本练习

    1、创建一个10G分区,并格式为ext4文件系统;    (1) 要求其block大小为2048, 预留空间百分比为2, 卷标为MYDATA, 默认挂载属性包含acl;       fidsk划分10G分区,partx命令强制内核重新读磁盘分区表,cat /proc/partitions是否内核识别到新分区 …

    Linux干货 2017-02-01
  • FHS文件系统下个各目录功能

    FHS文件系统下个各目录功能 FHS文件系统的建立是为了让开发者和用户可以预测软件安装文件和文件夹的位置。对整个linux的文件系统系统做了以下的规范:     /bin:命令二进制文件的存放目录;     /boot:系统启动时一些文件存放的目录,包含引导linux的重要文件,…

    Linux干货 2016-10-18
  • 磁盘管理(二)之swap、dd工具使用

    磁盘管理(二)之swap、dd工具使用   一、挂载点和/etc/fstab   (1)配置文件/etc/fstab,当系统启动时,自动加载该文件,会把写在配置文件里面的所有挂载点全部自动挂载上去,只要按照格式写,就不会丢失。   (2)文件挂载配置文件,如下图:    &nbs…

    Linux干货 2016-08-29