LINUX beginner notes-user group and permission management

Source: Internet
Author: User
User and group management command useradd & lt; user name & gt;/create a user grep & lt; user name & gt; /etc/shadow/verify whether the user is successfully created (the last user created on the last line of the configuration file) passwd & lt; Username & gt; /activate this account to log on and set the password userm...

User and group management commands
Useradd <用户名> /Create a user
Grep <用户名> /Etc/shadow/verify whether the user is successfully created (the last user created is working on the last line of the configuration file)
Passwd <用户名> /Activate the account to log on and set the password
Usermod-g <组名> <用户名> /Add existing users to the group
Usermod-G <组名> <用户名> /The user belongs to the original group and is added to another group.
Usermod-L <用户名> /Disable users
Usermod-U <用户名> /Restart a user
Usermod-e yyyy-mm-dd <用户名> /Set the account Expiration Time (y corresponds to year, m corresponds to month, d corresponds to day)
Userdel-r <用户名> /Delete the user and the user's Directory
Usermod-l <新名> <旧名> /Change user name
Passwd <用户名> /Activate the user and set the password
Groupadd <组名> /Create a group
Groups <组名> /Display the users in the group
Grep <组名> /Etc/group/verify whether the group is successfully created (the last group created is in the last line of the configuration file)
Groupdel <组名> /Delete group
Permission command
Use ll to view a file or directory as follows:

It must be 1 to 10 characters long and contain 1st characters in the file type. the 2-4 characters indicate the owner permission, the 5-7 characters indicate the group permission, and the 8-10 characters indicate other user permissions (r read, w write, x. The number is 421. If only r does not have x, you can only view the list under this directory, but not the content)
2: Number of hard links
3: file owner
4: all groups of files
5: file size (byte)
6: creation or modification time
7: file directory or name
Change the group of files and directories

Change the user of a file or directory

Change file and directory permissions

Related configuration files
Etc/passwd storage account info table

Etc/shadow storage account password table

Etc/group stores group information
By default, etc/login. defs creates basic account settings (such as password length and expiration time)


Etc/default/useradd default ID, root directory, default SHELL, etc.

Note:
1) the usermod command to disable and enable the account function is to add and delete the account before the user password in the/etc/shadow configuration file "! "Implemented. Of course, you can also manually add or delete "! "To achieve the effect.
2)

 

3)

4)

Problem:
1) after the user name is changed, the original directory name of the user in home does not change ??
Exercise test
1. modify the user configuration file so that the default user password cannot be less than five characters
2. create the user steven and jack, activate the password, create the group admin, and check whether the user exists in the configuration file.
3. Add user steven to the group admin,
4. create a directory prounder/directory, create a file hello.txt under the Directory, and enter the content (at will)
5. token permission
6. use chmod-RTO modify the propermission and then revoke the hello.txt permission.
7. modify pro stevenstevensteven, and the adminadmin (((( do not inherit permissions, hello.txt permission is owned by jack, rwx permission, and then try the permissions of the steven user on the file.
Author: "good study! Day .."

Related Article

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.