zoukankan      html  css  js  c++  java
  • 作业3

    1、创建/guanli 目录,在/guanli下创建zonghe 和 jishu 两个目录(一条命令)

    [root@localhost ~]# mkdir -p /guanli/zonghe |mkdir -p /guanli/jishu

    [root@localhost ~]# ls -l /guanli

    总用量 0

    drwxr-xr-x. 2 root root 6 7月  30 10:39 jishu

    drwxr-xr-x. 2 root root 6 7月  30 10:39 zonghe

    2、添加组帐号zonghe、caiwu、jishu,GID号分别设置为2001、2002、2003

    [root@localhost ~]# groupadd zonghe

    [root@localhost ~]# groupadd caiwu

    [root@localhost ~]# groupadd jishu

    [root@localhost ~]# groupmod -g 2001 zonghe

    [root@localhost ~]# groupmod -g 2002 caiwu

    [root@localhost ~]# groupmod -g 2003 jishu

    3、创建jerry、kylin、tsengia、obama用户,其中的kylin用户帐号在2020年12月30日后失效

    [root@localhost ~]# useradd -e 2020-12-30 kylin

    [root@localhost ~]# useradd tsengia

    [root@localhost ~]# useradd obama

    [root@localhost ~]# useradd jerry

    4、将jerry、kylin、tsengia、obama等用户添加到zonghe组内

    [root@localhost ~]# gpasswd -M jerry,obama,kylin,tsengia zonghe

    5、创建handy、cucci用户,其中cucci帐号的登录Shell设置为“/sbin/nologin”

    [root@localhost ~]# useradd -s /sbin/nologin cucci

    6、将handy、cucci等用户添加到jishu组内

    [root@localhost ~]# gpasswd -M handy,cucci jishu

    7、将上述的所有用户均要求加入到guanli组内

    [root@localhost ~]# gpasswd -M jerry,handy,cucci,kylin,tsengia,obama guanli

    8、将zonghe组内的obama用户删除

    [root@localhost ~]# gpasswd -d obama zonghe

    9、为jerry用户设置密码为“123456”(使用普通方法)

       为cucci用户设置密码为“redhat”(使用--stdin方法) 

    [root@localhost ~]# passwd jerry

    更改用户 jerry 的密码 。

    新的 密码:

    无效的密码: 密码少于 8 个字符

    重新输入新的 密码:

    passwd:所有的身份验证令牌已经成功更新。

    [root@localhost ~]# echo "redhat"|passwd --stdin cucci

    更改用户 cucci 的密码 。

    10、将jerry用户锁定,并查看锁定状态

    [root@localhost ~]# passwd -l jerry

    锁定用户 jerry 的密码 。

    passwd: 操作成功

    11、打开两个xshell窗口,通过(who 或者 w)命令查看连接状态,并通过fuser杀掉其中一个

    [root@localhost ~]# w

     13:00:59 up  5:43,  3 users,  load average: 0.02, 0.02, 0.05

    USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT

    root     :0       :0               09:07   ?xdm?   2:30   0.47s gdm-session-wor

    root     pts/1    192.168.100.176  09:17    3.00s  0.77s  0.08s w

    root     pts/2    192.168.100.176  11:07    1:52m  0.11s  0.11s -bash

    [root@localhost ~]#fuser -k /dev/pts/2

    12、查看cucci用户,属于那些组,并查看其详细信息

    [root@localhost ~]# groups cucci

    cucci : cucci jishu guanli

    [root@localhost ~]# finger cucci

    Login: cucci                               Name:

    Directory: /home/cucci                  Shell: /sbin/nologin

    Never logged in.

    No mail.

    No Plan.

    13、手工创建账号student

    [root@localhost ~]# nano /etc/group

    student:x:2003

    [root@localhost ~]#nano /etc/passwd

    student:x:2000:2003::/home/mysql:/bin/bash

    [root@localhost ~]#nano /etc/shadow

    student:$6$7yjiIGao$ZCQWEBQnOhDZ6/PI3lTvHwCCm6baT4rZ8r1veEZzfbE8cxcR6iZg9vI00s9Eo78/d1iNpdnOk/Jv9e97v.IWg0:18107:0:99999:7:::

    [root@localhost ~]# cp -R /etc/skel /home/student

    [root@localhost ~]#chown -R student:student /home/student

    [root@localhost ~]#chmod -R go= /home/student

    [root@localhost ~]# su student

    [student@localhost root]$

    14、设置权限及归属:

       /guanli目录属组设为guanli

       /guanli/zonghe目录的属组设为zonghe

       /guanli/jishu目录的属组设为jishu

       设置3个目录都是禁止其他用户访问的权限

    [root@localhost ~]# chown :guanli /guanli

    [root@localhost ~]# chown  :zonghe  /guanli/zonghe

    [root@localhost ~]# chown  :jishu /guanli/jishu

    15、建立公共目录/ceshi

       允许技术组内的所有用户读取、写入、执行文件

       禁止其他用户读、写、执行

    [root@localhost ~]# mkdir /ceshi

    [root@localhost ~]# chmod g+w /ceshi

    [root@localhost ~]# chmod o-rx /ceshi

    [root@localhost ~]# ls -ld /ceshi

    Drwxrwx---. 2 root jishu 6 7月  30 11:36 /ceshi

    16、清除jerry用户密码

    [root@localhost ~]# passwd -d jerry

    清除用户的密码 jerry。

    passwd: 操作成功

    17、锁定cucci用户密码并查看状态

    [root@localhost ~]# passwd -S cucci

    cucci LK 2019-07-30 0 99999 7 -1 (密码已被锁定。)

    18、修改obama用户的UID为8888

    [root@localhost ~]# usermod -u 8888 cucci

    19、通过passwd命令修改kylin用户的最长密码使用期限为60天

    [root@localhost ~]# passwd -x 60 kylin

    调整用户密码老化数据kylin。

    passwd: 操作成功

    20、通过id groups finger等命令查看用户handy信息

    [root@localhost ~]# id handy

    [root@localhost ~]# groups handy

    handy : handy jishu guanli

    [root@localhost ~]# finger handy

  • 相关阅读:
    SQLdiag-配置文件-ProfilerCollector
    SQLdiag-配置文件-PerfmonCollector
    SQLdiag-初识
    Trace-跟踪高消耗的语句需添加哪些事件
    RML Utilities for SQL Server
    【译】第十五篇 Integration Services:SSIS参数
    修改数据文件和日志文件路径
    Trace-导出已有的服务器端跟踪
    iphoneX的适配问题
    添加阿里巴巴图标,让你页面小图标都是CSS3写成
  • 原文地址:https://www.cnblogs.com/maoyanqing/p/11274179.html
Copyright © 2011-2022 走看看