Linux 第五天: (08月01日) 练习和作业

Linux 第五天: (08月01日) 练习和作业

 

 

 

 

创建用户gentoo, 附加组为bin和root, 默认shell为/bin/csh, 注释信息为"Gentoo Distribution"

useradd -G bin,root -c "Gentoo Distribution" -s /bin/csh gentoo ; id gentoo

 

 

创建名为admins的组
用户natasha, 使用admins作为附属组
用户harry, 也是有admins作为附属组
用户sarah, 不可交互登录系统, 且不是admins成员
natasha, harry, sarah密码都是centos

 

groupadd admins
useradd -G admins natasha
useradd -G admins harry
useradd -s /sbin/nologin sarah
echo "centos" |passwd –stdin natasha
echo "centos" |passwd –stdin harry
echo "centos" |passwd –stdin sarah

 

 

 

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

 useradd -u 1234 -g bin -G root,ftp -s /bin/csh -d /testdir/testuser testuser

 

 

 

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

 usermod testuser -u 4321 -g root -G nobody -l test -dm /home/test

 

 

 

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

 

vi user.txt

 

user1:x:3000:3000::/home/testdir/user1/:/bin/csh
user2:x:3001:3001::/home/testdir/user2/:/bin/csh
user3:x:3002:3002::/home/testdir/user3/:/bin/csh
user4:x:3003:3003::/home/testdir/user4/:/bin/csh
user5:x:3004:3004::/home/testdir/user5/:/bin/csh
user6:x:3005:3005::/home/testdir/user6/:/bin/csh
user7:x:3006:3006::/home/testdir/user7/:/bin/csh
user8:x:3007:3007::/home/testdir/user8/:/bin/csh
user9:x:3008:3008::/home/testdir/user9/:/bin/csh
user10:x:3009:3009::/home/testdir/user10/:/bin/csh

 

newusers user.txt

 

vi pawd.txt

 

user1:user1pass
user2:user2pass
user3:user3pass
user4:user4pass
user5:user5pass
user6:user6pass
user7:user7pass
user8:user8pass
user9:user9pass
user10:user10pass

 

cat pawd.txt |chpasswd

 

cp -r /etc/skel/.[^.]* /testdir/user1
cp -r /etc/skel/.[^.]* /testdir/user2
cp -r /etc/skel/.[^.]* /testdir/user3
cp -r /etc/skel/.[^.]* /testdir/user4
cp -r /etc/skel/.[^.]* /testdir/user5
cp -r /etc/skel/.[^.]* /testdir/user6
cp -r /etc/skel/.[^.]* /testdir/user7
cp -r /etc/skel/.[^.]* /testdir/user8
cp -r /etc/skel/.[^.]* /testdir/user9
cp -r /etc/skel/.[^.]* /testdir/user10

 

 

 

 

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

(0)
dengjiandengjian
上一篇 2016-08-08
下一篇 2016-08-08

相关推荐

  • 标准I/O和管道

    程序包含指令和数据,经常需要读入数据和输出数据 打开的文件都有一个fd:file descriptor(文件描述符) 用nano打开一个文件,查看其PID  0,1,2就是所谓的文件描述符。 在Linux里输入输出和错误都由这三个描述符来表示 标准输入(STDIN) -0 默认接受来自键盘的输入 标准输出(STDOUT)-1 默认输出到终端窗口 标…

    Linux干货 2016-08-08
  • Linux 文件管理常用基本命令

    马哥教育网络班21期+第二周练习 目录管理 ls (list):列出目录及内容 ls [OPTION]… [FILE]…     -l:长格式显示文件的详细属性信息         -rwxr-xr-x.&nbs…

    Linux干货 2016-07-17
  • linux用户和组管理

    linux用户和组管理 类Unix系统的设计初衷就是为让多用户同时工作,所以也迫使Linux系统有了极强的安全性,在前面安装红帽RHEL7操作系统时还特别要求“设置root用户密码”,而root用户是存在于所有类UNIX系统中的”超级用户”。 用户管理 root账户介绍(超级管理员) root用户拥有极高的系统所有权,能够管理系统的各项功能,如添加/删除用户…

    Linux干货 2016-09-05
  • 压缩与解压

        compress 命令使用“Lempress-Ziv”编码压缩数据文件。compress是个历史悠久的压缩程序,文件经它压缩后,其名称后面会多出”.Z”的扩展名。当要解压缩时,可执         &nbsp…

    2017-08-14
  • ThirdWeek_SecondDay

    Python学习笔记整理

    Linux干货 2017-10-09
  • 通络通信

    网络详解: 网络的osi层次结构: 物理层: 以太网规定,连入网络的所有设备,都必须具有”网卡”接口。数据包必须是从一块网卡,传送到另一块网卡。 网卡的地址,就是数据包的发送地址和接收地址,这叫做MAC地址。 每块网卡出厂的时候,都有一个全世界独一无二的MAC地址,长度是48个二进制位,通常用12个十六进制数表示。 前6个十六进制数是厂商编号,后6个是该厂商…

    Linux干货 2016-09-02