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

    1、创建/guanli 目录,在/guanli下创建zonghe 和 jishu 两个目录(一条命令)
    [root@localhost ~]# mkdir -pv /guanli/zonghe -p /guanli/jishu
    mkdir: 已创建目录 "/guanli/zonghe"
    mkdir: 已创建目录 "/guanli/jishu"
    [root@localhost ~]# cd /guanli
    [root@localhost guanli]# ls
    jishu zonghe
    2、添加组帐号zonghe、caiwu、jishu,GID号分别设置为2001、2002、2003
    [root@localhost guanli]# groupadd -g 2001 zonghe ; groupadd -g 2002 caiwu ;groupadd -g 2003 jishu
    3、创建jerry、kylin、tsengia、obama用户,其中的kylin用户帐号在2020年12月30日后失效
    [root@localhost guanli]# useradd jerry ; useradd -e 2020-12-30 kylin ; useradd tsengia ; useradd obama
    4、将jerry、kylin、tsengia、obama等用户添加到zonghe组内
    [root@localhost ~]# gpasswd -M jerry,kylin,tsengia,obama zongheuse
    5、创建handy、cucci用户,其中cucci帐号的登录Shell设置为“/sbin/nologin”
    [root@localhost ~]# useradd handy
    [root@localhost ~]# useradd -s /sbin/nologin cucci
    6、将handy、cucci等用户添加到jishu组内
    [root@localhost ~]# gpasswd -M handy,cucci jishu
    7、将上述的所有用户均要求加入到guanli组内
    [root@localhost ~]# gpasswd -M handy,cucci,jerry,kylin,tsengia guanli
    8、将zonghe组内的obama用户删除
    [root@localhost ~]# gpasswd -d obama zonghe
    9、为jerry用户设置密码为“123456”(使用普通方法)
    [root@localhost ~]# passwd jerry
    为cucci用户设置密码为“redhat”(使用--stdin方法)
    [root@localhost ~]# echo 'redhat' |passwd --stdin cucci
    10、将jerry用户锁定,并查看锁定状态
    [root@localhost ~]# passwd -l jerry
    [root@localhost ~]# passwd -S jerry
    11、打开两个xshell窗口,通过(who 或者 w)命令查看连接状态,并通过fuser杀掉其中一个
    [root@localhost ~]# who
    root :0 2019-07-29 14:03 (:0)
    root pts/0 2019-07-29 14:06 (:0)
    root pts/2 2019-07-30 13:01 (192.168.1.1)
    root pts/3 2019-07-30 14:35 (192.168.1.1)
    [root@localhost ~]# fuser -u /root/
    /root: 20940c(root)
    12、查看cucci用户,属于那些组,并查看其详细信息
    [root@localhost ~]# groups cucci
    [root@localhost ~]# finger cucci
    cucci : cucci jishu guanli
    13、手工创建账号student
    [root@localhost ~]# vi /etc/passwd
    student:x:1007:1007::/home/handy:/bin/bash
    14、设置权限及归属:
    /guanli目录属组设为guanli
    /guanli/zonghe目录的属组设为zonghe
    /guanli/jishu目录的属组设为jishu
    设置3个目录都是禁止其他用户访问的权限
    [root@localhost ~]# vi /etc/passwd
    [root@localhost ~]# chown :zonghe /guanli/zonghe
    [root@localhost ~]# chown :jishu /guanli/jishu
    [root@localhost ~]# chmod 750 /guanli
    [root@localhost ~]# chmod 750 /guanli/zonghe
    [root@localhost ~]# chmod 750 /guanli/jishu
    15、建立公共目录/ceshi
    允许技术组内的所有用户读取、写入、执行文件
    禁止其他用户读、写、执行
    [root@localhost ~]# chmod 770 /ceshi
    16、清除jerry用户密码
    [root@localhost ~]# passwd -d jerry
    17、锁定cucci用户密码并查看状态
    [root@localhost ~]# passwd -S cucci
    18、修改obama用户的UID为8888
    [root@localhost ~]# usermod -u 8888 obama
    obama:x:8888:1004::/home/obama:/bin/bash
    19、通过passwd命令修改kylin用户的最长密码使用期限为60天
    [root@localhost ~]# passwd -x 60 kylin
    20、通过id groups finger等命令查看用户handy信息
    [root@localhost ~]# id handy [root@localhost ~]# finger handy
    [root@localhost ~]# groups handy

  • 相关阅读:
    延时函数出错,volatile一例
    【转】STM32中的抢占优先级、响应优先级概念
    【转载】串口中怎样接收一个完整数据包的解析
    ARM-ContexM3/4组优先级和子优先级抢占规则
    【转载】Keil中的USE MicroLib说明
    线程让出实验【RT-Thread学习笔记 4】
    线程优先级抢占实验【RT-Thread学习笔记 3】
    RT-Thread的线程(任务)处理【RT-Thread学习笔记 2】
    熟悉RT-Thread的软硬件环境【RT-Thread学习笔记 1】
    RT-Thread下的串口驱动程序分析【转载】
  • 原文地址:https://www.cnblogs.com/lvhemu/p/11280295.html
Copyright © 2011-2022 走看看