zoukankan      html  css  js  c++  java
  • 权限及归属管理

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

    mkdir /guanli/{zonghe,jishu}

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

    groupadd -g 2001 zonghe
    groupadd -g 2002 caiwu
    groupadd -g 2003 jishu

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

    useradd jerry
    useradd -e 2020-12-30 kylin
    useradd tsengia
    useradd obama


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

    gpasswd -M jerry,kylin,tsengia,obama zonghe

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

    useradd handy
    useradd -s /sbin/nologin cucci

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

    gpasswd -M handy,cucci jishu

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

    gpasswd -M jerry,kylin,tsengia,obama,handy,cucci guanli

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

    gpasswd -d obama zonghe

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

    passwd jerry
    echo '123' | passwd --stdin cucci

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

    passwd -l jerry
    passwd -S jerry

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

    who/w
    fuser -k /dev/pts/6

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

    groups cucci
    yum -y install finger
    finger cucci

    13、手工创建账号student

    [root@localhost ~]# vi /etc/group
    在最后一行添加student:x:2000:
    [root@localhost ~]# vi /etc/passwd
    在最后一行添加student:x:2001:2000::/home/student:/bin/bash
    [root@localhost ~]# vi /etc/shadow
    在最后一行添加student:X:18107:0:99999:7:::
    [root@localhost ~]# mkdir /home/student
    [root@localhost ~]# chown -R student:student /home/student
    [root@localhost ~]# chmod -R go= /home/student
    [root@localhost ~]# cp /etc/skel/.bashrc /home/student/
    [root@localhost ~]# cp /etc/skel/.bash_profile /home/student/
    [root@localhost ~]# cp /etc/skel/.bash_logout /home/student/
    [root@localhost ~]# su student

     


    14、设置权限及归属:
    /guanli目录属组设为guanli
    /guanli/zonghe目录的属组设为zonghe
    /guanli/jishu目录的属组设为jishu
    设置3个目录都是禁止其他用户访问的权限

    chown :guanli /guanli
    chown :zonghe /guanli/zonghe
    chown :jishu /guanli/jishu
    chown -R 750 /guanli

    15、建立公共目录/ceshi
    允许技术组内的所有用户读取、写入、执行文件
    禁止其他用户读、写、执行

    setfacl -m g:jishu:rwx /tmp/ceshi
    chown -R 770 /tmp/ceshi

    16、清除jerry用户密码

    passwd -d jerry

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

    passwd -l cucci
    passwd -S cucci

    18、修改obama用户的UID为8888

    usermod -u 8888 obmam

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


    passwd -x 60 kylin

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

    id handy
    groups handy
    finger handy

  • 相关阅读:
    Zabbix3.2监控Windows的内存使用百分比并在内存使用率超过85%的时候触发报警
    zabbix监控 linux/windows 主机tcp连接状态
    Exchange2016 & Skype for business 集成之三统一联系人存储
    Exchange2016 & Skype for business集成之二 OWA集成IM
    Exchange2016 & Skype for business 集成之一配置合作伙伴应用程序
    Office Online Server 2016 部署和配置
    Skype for Business 安装组件RewriteModule失败
    Exchange Server 2016 安卓手机打不开超过10M的附件问题处理
    Exchange Server 2016 管理邮箱收发限制
    static修饰类的作用
  • 原文地址:https://www.cnblogs.com/990624lty-jhc/p/11274320.html
Copyright © 2011-2022 走看看