Linux Users and Groups

Source: Internet
Author: User

Linux is a multi-user time-sharing system, want to use system resources, you must have a legitimate account password.
UID and GID
Normal user root user system user
The UID equivalent to the school number GID equivalent class, each student has a unique school number, belongs to a class, other groups are interest classes.
Use the ID command to determine your own UID
[[email protected] grub.d]# ID
Uid=0 (Root) gid=0 (root) group =0 (root) environment =unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
[[email protected] grub.d]$ ID
uid=1000 (Liuyu) gid=1000 (Liuyu) group =1000 (Liuyu), ten (wheel) environment =unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
Use the Groups command to confirm which groups you belong to
[email protected] grub.d]$ groups
Liuyu Wheel
/etc/passwd and/etc/shadow files
New User Useradd Zhangsan
The system first appends a record to the end of/etc/passwd and/etc/shadow, assigning a UID to the user.
Next, create a home directory for the user in the/House directory,
Then, copy all the files under/etc/skel to the/home/zhangsan directory,
Finally, create a new user group with the same name as Zhangsan.
Useradd has some parameters that can specify UID GID and custom home directories etc.
Modify Password directory passwd
After the user is created, if you do not set a password, you cannot log on to the system.
Ordinary users can modify their own password, the root user can modify the password of all users.
Modify User Usermod
Usermod-l Zhangsan #锁定用户
Usermod-u Zhangsan #解锁用户
Delete User Userdel-r Zhangsan #删除zhangsan相关的所有信息
New User Group Groupadd
Delete a user group Groupdel
View user commands: Who users W

Switch users: Su-and sudo
Visudo command to edit the sudoers file
Zhangsan all= (All) Nopasswd:all #这一行的意思是zhangsan这个用户可以从任何地方登陆后执行任何人的任何命令
Zhangsan all= (All) Nopasswd:/sbin/shutdown,/usr/bin/reboot #指定可以做哪些操作
[email protected] etc]# Yum install-y expect #安装一个密码生成工具
[Email protected] etc]# mkpasswd
31! Kmussi

Design to command parameters need to practice more

Linux Users and Groups

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.