zoukankan      html  css  js  c++  java
  • su,exit,adduser,deluser,usermod,groups

    exit

    退出当前用户

    su

    切换到指定用户,缺省表示切换到root用户

    adduser

    创建一个用户的时候其实是创建了一个用户和同名的用户组,它们都会UID,所属的GID,创建时一个用户属于和自己同名的用户组,可以更改一个用户所属的用户组,但是之前创建的同名用户组还会存在
    sudo adduser new_user_name

    $sudo adduser test_user
    [sudo] password for jiang: 
    Adding user `test_user' ...
    Adding new group `test_user' (1001) ...
    Adding new user `test_user' (1001) with group `test_user' ...
    Creating home directory `/home/test_user' ...
    Copying files from `/etc/skel' ...
    Enter new UNIX password: 
    Retype new UNIX password: 
    passwd: password updated successfully
    Changing the user information for test_user
    Enter the new value, or press ENTER for the default
    	Full Name []: 
    	Room Number []: 
    	Work Phone []: 
    	Home Phone []: 
    	Other []: 
    Is the information correct? [Y/n] y
    

    deluser

    删除一个用户
    sudo deluser --remove-home yu

    groups

    查看当前用户的组内成员
    /etc/group文件包含了所有的用户组
    /etc/shadow和/etc/passwd包含了所有的用户名和密码信息

    usermod

    更改用户所属的组
    $sudo usermod -g GID_or_GroupName UID_or_UserName
    $sudo usermod -G username groupA #user离开原来的组,加入到groupA中
    $sudo usermod -a -G user groupA #-a 表示-append,user不离开原来的组,加入到groupA中

  • 相关阅读:
    Hrbust-1492 盒子(二分图最大匹配)
    数据结构——二叉树的建立和遍历(递归建树&层序遍历建树)
    HDU 1710 二叉树遍历
    HDU 2891
    HDU 2895 贪心 还是 大水题
    POJ 2896 另解暴力
    POJ 2896 AC自动机 or 暴力
    HDU 1714 math
    POJ 1328 贪心
    POJ 2109 巧妙解法
  • 原文地址:https://www.cnblogs.com/xiaojiang1025/p/5958132.html
Copyright © 2011-2022 走看看