zoukankan      html  css  js  c++  java
  • 作业

    [root@localhost ~]# groupadd group1

    [root@localhost ~]# mkdir -p /testgroup1

    [root@localhost ~]# groupadd jiaoxue

    [root@localhost ~]# useradd -d /testgroup1/tom/-group1 -Gjiaoxue -s /bin/bash -e2019-12-12 tom

    [root@localhost ~]# passwd tom

    更改用户 tom 的密码 。

    新的 密码:

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

    重新输入新的 密码:

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

    [root@localhost ~]# tail -1 /etc/passwd

    tom:x:1000:1000::/testgourp1/tom/:/bin/bash

    [root@localhost ~]# tail -1 /etc/shadow

    tom:$6$hd0TXw2h$We.V89RFatV0lgB/lFDnxLJBVE2SMKSMAOue7E0bIn71fG3N/rhUZ58cfxM6pSFnBMVMNp3Zn.7BUXt/HcbEQ/:18105:0:99999:7::18242:

    [root@localhost ~]# vi ~tom/.bash_profile

    # .bash_profile

    # Get the aliases and functions

    if [ -f ~/.bashrc ]; then

            . ~/.bashrc

    fi

    # User specific environment and startup programs

    PATH=$PATH:$HOME/.local/bin:$HOME/bin

    export PATH

    echo"welcome tom!"

    [root@localhost ~]# vi ~tom/.bashrc

    # .bashrc

    # Source global definitions

    if [ -f /etc/bashrc ]; then

            . /etc/bashrc

    fi

    # Uncomment the following line if you don't like systemctl's auto-paging feature:

    # export SYSTEMD_PAGER=

    # User specific aliases and functions

    echo "hi!this is a new bash"

    [root@localhost ~]# vi ~tom/.bash_logout

    # ~/.bash_logout

    echo "byebye tom!"

    Last login: Sun Jul 28 13:08:37 2019

    /usr/bin/xauth:  file /testgourp1/tom//.Xauthority does not exist

    hi!this is a new bash

    welcome tom!

    [tom@localhost ~]$ logout

    byebye tom!

    [root@localhost ~]# passwd -l tom

    锁定用户 tom 的密码 。

    passwd: 操作成功

    [root@localhost ~]# passwd -u tom

    解锁用户 tom 的密码。

    passwd: 操作成功

    [root@localhost ~]# passwd -S tom

    tom PS 2019-07-28 0 99999 7 -1 (密码已设置,使用 SHA512 算法。)

    [root@localhost ~]# passwd -d tom

    清除用户的密码 tom

    passwd: 操作成功

    [root@localhost ~]# passwd -x 120 tom

    调整用户密码老化数据tom

    passwd: 操作成功

    [root@localhost ~]# grep tom /etc/shadow

    tom::18105:0:120:7::18242:

    [root@localhost ~]# passwd -w5 tom

    调整用户密码老化数据tom

    passwd: 操作成功

    [root@localhost ~]# grep tom /etc/shadow

    tom::18105:0:120:5::18242:

    [root@localhost ~]# grep tom /etc/shadow

    tom::18105:0:120:5:7:18242:

    [root@localhost ~]# usermod -l tom1 tom

    [root@localhost ~]# tail -1 /etc/passwd

    tom1:x:1000:1000::/testgourp1/tom/:/bin/bash

    [root@localhost ~]# tail -1 /etc/passwd

    tom1:x:1000:1000:jiaoxue:/testgourp1/tom/:/bin/bash

    [root@localhost ~]# userdel -r tom1

    [root@localhost ~]# ls /testgroup1

    ls: 无法访问/testgroup1: 没有那个文件或目录

    [root@localhost ~]# tail -3 /etc/group

    tcpdump:x:72:

    group1:x:1000:

    jiaoxue:x:1001:

    [root@localhost ~]# groupadd -g 888 market

    [root@localhost ~]# tail -4 /etc/group

    tcpdump:x:72:

    group1:x:1000:

    jiaoxue:x:1001:

    market:x:888:

    [root@localhost ~]# gpasswd -a test1 market

    正在将用户test1”加入到“market”组中

    [root@localhost ~]# tail -4 /etc/gourp

    [root@localhost ~]# tail -4 /etc/group

    market:x:888:test1

    test1:x:1002:

    test2:x:1003:

    test3:x:1004:

    [root@localhost ~]# gpasswd -d test1 market

    正在将用户test1”从“market”组中删除

    [root@localhost ~]# tail -4 /etc/group

    market:x:888:

    test1:x:1002:

    test2:x:1003:

    test3:x:1004:

    [root@localhost ~]# gpasswd -M test1,test2,test3 market

    [root@localhost ~]# tail -4 /etc/group

    market:x:888:test1,test2,test3

    test1:x:1002:

    test2:x:1003:

    test3:x:1004:

    [root@localhost ~]# gpasswd -M test1 market

    [root@localhost ~]# tail -4 /etc/group

    market:x:888:test1

    test1:x:1002:

    test2:x:1003:

    test3:x:1004:

    [root@localhost ~]# groups test2

    test2 : test2

    [root@localhost ~]# groups test3

    test3 : test3

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

    [root@localhost ~]# groups test2

    [root@localhost ~]# groups test3

    test3 : test3 market

    [root@localhost ~]# groupdel market

    [root@localhost ~]# tail -5 /etc/group

    group1:x:1000:

    jiaoxue:x:1001:

    test1:x:1002:

    test2:x:1003:

    test3:x:1004:

    [root@localhost ~]# id test1

    uid=1000(test1) gid=1002(test1) =1002(test1)

    [root@localhost ~]# id

    uid=0(root) gid=0(root) =0(root) 环境=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023

    [root@localhost ~]# groups test1

    test1 : test1

    [root@localhost ~]# groups

    [root@localhost ~]# groups

    root

    [root@localhost ~]# finger test1

    Login: test1           Name:

    Directory: /home/test1               Shell: /bin/bash

    Never logged in.

    No mail.

    No Plan.

    [root@localhost ~]# finger

    Login     Name       Tty      Idle  Login Time   Office     Office Phone   Host

    root      root      *:0             Jul 26 12:20                           (:0)

    root      root       pts/0      50  Jul 28 11:22                           (:0)

    root      root       pts/3          Jul 28 13:01                           (192.168.50.1)

    [root@localhost ~]# w

     13:52:38 up  2:23,  3 users,  load average: 0.00, 0.01, 0.05

    USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT

    root     :0       :0               12   ?xdm?   1:30   0.20s /usr/libexec/gn

    root     pts/0    :0               11:22   51:18   0.03s  0.03s bash

    root     pts/3    192.168.50.1     13:01    6.00s  0.40s  0.03s w

    [root@localhost ~]# whoami

    root

    [root@localhost ~]# who

    root     :0           2019-07-26 12:20 (:0)

    root     pts/0        2019-07-28 11:22 (:0)

    root     pts/3        2019-07-28 13:01 (192.168.50.1)

  • 相关阅读:
    线程互斥与同步
    JSP中传递数据出现的乱码问题
    JavaWeb学习——获取类路径下的资源
    Java初始化顺序
    Socket网络编程
    算法练习--LeetCode--17. Letter Combinations of a Phone Number
    算法练习--LeetCode--29. Divide Two Integers
    XCode10 swift4.2 适配遇到的坑
    leetCode :103. Binary Tree Zigzag Level Order Traversal (swift) 二叉树Z字形层次遍历
    iOS 拼音 Swift K3Pinyin
  • 原文地址:https://www.cnblogs.com/CAPF/p/11258949.html
Copyright © 2011-2022 走看看