第四天作业

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

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

2 、创建 下面的用户、组和组成员关系,名字为 为admins的组

用户natasha ,使用admins  作为附属组

用户harry ,也使用admins  作为附属组

用户sarah ,不可交互登录系统, 且 不是admins的成员,natasha ,harry ,sarah 密码 都是centos

1
2
3
4
5
6
useradd -G admins natasha
useradd -G admins harry
useradd -r -s /sbin/nologin sarah
echo "centos" |passwd --stdin=natasha
echo "centos" |passwd --stdin=harry
echo "centos" |passwd --stdin=sarah

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

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

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

1
usermod -u 4321 -g 0 -G nobody -l test -md /home/test testuser

5、批量创建帐号:user1…user10

uid:3000-3009,shell:/bin/csh,home:/testdir/username

passwd:usernamepass

注意家目录相关配置,使用户正常登录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
touch users.txt
vi users.txt
newusers users.txt
touch passwd.txt
vi passwd.txt
cat passwd.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


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

(0)
NameLessNameLess
上一篇 2016-08-04 14:41
下一篇 2016-08-04 14:41

相关推荐

  • linux基础入门之二

    linux基础入门之二 1、Linux上的文件管理类命令都有哪些,其常用的使用方法及其相关示例演示。 1.cp文件复制: 常用选项: -i:交互式复制,即覆盖之前提醒用户确认; -f:强制覆盖目标文件; -r, -R:递归复制目录; -d:复制符号链接文件本身,而非其指向的源文件; -a:-dR –…

    Linux干货 2016-09-26
  • 搭建博客程序wordpress

    根据需求安装相关软件,搭建实验环境: #CentOS 6:Httpd,PHP,mysql-server,php-mysql #CentOS 7:Httpd,php,php-mysql mariadb-server 下载wordpress程序,并解压至/var/www/html/目录下 [root@centos077 html]# pwd /var/www/h…

    2017-04-28
  • Shell脚本编程(上)

        Shell脚本编程基础 Shell 脚本基础:包含一些命令或声明并符合一定格式的文本文件Shell 脚本用途:        1. 自动化常用命令        2. 执行系统管理和故障排除        3. …

    2017-04-16
  • 进程管理,计划任务

    一、进程相关概念及系统管理工具     进程概念         内核的功用:进程管理、文件系统、网络功能、内存管理、驱动程序、 安全功能等         P…

    Linux干货 2016-09-18
  • Linux的哲学思想第二篇

    Linux的哲学思想 一切皆文件 物理终端 物理终端指的是显示器等硬件终端设备,文件存在于 /dev/console 这个路径下 虚拟终端 虚拟终端指的是在linux命令行连接的终端,文件存在于 /dev/tty# [1,6] 这个路径下 串行终端 指的是使用计算机串行端口连接的终端设备,文件存在于 /dev/ttyS# 这个路径下 伪终端 指的是在Xshe…

    2018-02-26
  • yum——替你排忧解难的前端包安装工具

    yum CentOS前端工具: yum, dnf 统一资源定位符:URL YUM: Yellowdog Update Modifier,rpm的前端程序,用来解决软件包相关依赖性,可以在多个库之间定位软件包,自动安装软件包,以及该软件包的依赖包,up2date的替代工具 yum repository: yum repo (yum仓库)  &nbsp…

    Linux干货 2016-08-24