Linux User and group management __linux

Source: Internet
Author: User

Centos:

-------------------------------------------------------#创建用户 (default create group with same name) Useradd myuser1 adduser-g MySQL myuser2 adduser-d/home/myuser3-p 123456 myuser3 adduser-g root-g mysql,postgres myuser4 #设置用户密码 passwd myuser4 #查看用户信息 (Myus Er3 password is plaintext; myuser4 password is ciphertext) Cat/etc/shadow cat/etc/passwd #查看用户uid及属组gid ID root ID 1000 #更改用户模式 (options similar to creation) Usermod-l Myuse
R1 usermod-g Root Myuser2 #添加当前用户到其他组 usermod-a-G mysql,postgres myuser3 #切换用户 su myuser4 su-myuser4 #查看当前所有连接用户 W, who, users #查看当前登录用户 WhoAmI, Id-un, who am I, who mom likes, #查看某用户登录历史 (such as root) last root #剔除某用户连接 ps-ef|
grep pts/? kill-9 pid #删除用户 userdel myuser1 userdel-r myuser2-------------------------------------------------------#创建组 Group Add MyGroup #查看组 Cat/etc/group | Cut-d ': '-f1 #更改组名 (MyGroup to Kkgroup) groupmod-n Kkgroup #给用户 (such as root) add other groups MyGroup Kkgroup-G usermod-a ro OT #查看组中所有用户 groups Kkgroup #同步信息: from/etc/passwd to/etc/shadow pwconv #同步信息: from/etc/group to/etc/gshadow Grpconv #删除组 Gro UPdel Kkgroup------------------------------------------------------- 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.