Linux-ubuntu User and Rights Management __linux

Source: Internet
Author: User
Tags chmod

1 User Management related configuration

/ETC/PASSWD saved the user's password information
/etc/shadow encrypted password information for the actual saved user

/etc/group User Group Information

1.1 User Management related configuration

• When using shadow passwords, the/etc/shadow file holds the actual encrypted user
Password.
Name:password:last:min:max:warn:inactive:
Expire:reserved
12 User Management

• Increase User useradd, AddUser

When you use the AddUser command, it adds this username and creates and the user name
Name the same group name, add the username to your group, and
/home directory to create a directory with the same name as the user name and copy the/etc/skel directory
below to/home/username/directory, prompt for password.

User Management

• Increase User useradd, AddUser

When you use the command useradd, it adds this username and creates and the user name
The same group name, but it does not create a directory based on the user name under the/home directory, and
Do not prompt to create a new password. It only creates a normal user and cannot use this user name to
Log in to the system.

• Delete User Userdel

Delete only information for this account in/etc/passwd and/etc/shadow:
# Userdel Guest

Add the "-r" parameter, along with the related file delete:
# Userdel–r Guest


Add Group Command Groupadd
G-GID Set the value of the group ID
# groupadd–g NewGroup

Delete Group Command Groupdel

# Groupdel NewGroup
passwd commands commonly used parameters:
-K retention of expiring users can still be used after expiration
-D Delete User password
-L lock user password so that it cannot change password
-U Unlock user password
-S displays user password status

Use the passwd command to modify a user's password

The CHAGE-M command forces the user to login to change the password next time

# Chage–m 0 Username

Chage–l View user Information
# chage–l Username

User Information query:

ID Query the user's uid,gid and the owning group

Groups query groups that users can support

Finger queries Some of the user's relevant information


To manually add user steps:

1. Add new Group (/etc/group)

2. Create account information (/ETC/PASSWD)

3. Sync passwd and Shadow Files (Pwconv)

4. Set account password (passwd)

5. Create the user's root directory (Cp–r/etc/skel/home/username)

6. Change Owner property of User Directory

(Chown–r username.group/home/username)

User creates an instance manually:

1. Add group information: # Vi/etc/group

groupname:x:520:

2. Add user information: # VI/ETC/PASSWD

username:x:520:520::/home/username:/bin/bash

3. Synchronous passwd and shadow:# Pwconv

4. Set User password: # passwd username

5. Create the user's root directory: # cp–r/etc/skel/home/username

6. Modify the User directory permissions:

# Chown–r Username.groupname/home/username
3 file Rights Management

Chown Change the owner of the document
chgrp Change the file's owning group
chmod changes the file's writable, readable, executable, and other attributes
Umask changes the properties of a preset file or directory when it is created

chmod command Detailed

   # chmod +x Hello
      give all users execute permissions for the Hello file
   # chmod 777 Hel Lo
      give all users permission to the Hello file
   # chmod u+rwx Hello
    ;   all operation rights for the current user for the Hello file
   # chmod Hello
      The current user has all permissions to the hello file, and no other user has any permissions

R 4 Read permission u Current user
W 2 Write permission G Group user
X 1 Execute permissions o other user

4 Security

The SU command toggles the root user right in the normal user login state.

sudo temporarily uses root permission to operate, and when the command is executed, the permission is lifted.

The habit of Linux systems is to use the system with minimal or no root privileges.

Do, stop the boot on the direct root login, operation in the end.

The "-" option is recommended when changing a normal user to the root user, so that you can use the

The environment variable and working directory of root are brought in at the same time.

"Little knowledge": The environment variable is actually a collection of parameters for the user's running environment. Linux is a
Multi-user operating system. And after each user logs on to the system, there will be a proprietary running
Environment. Typically, the default environment for each user is the same, and the default environment is actually
Is the definition of a set of environment variables. Users can customize their own operating environment, and the method
is to modify the corresponding system environment variables.

       common environment variables are as follows: &NBSP
       path is the system path  
       Home is the system root directory  
       Histsize refers to the number of bars that hold history command records &NBSP
       logname refers to the current user's logon name  
        hostname refers to the name   of the host;
       Shell refers to what kind of shell the current user is using &NBSP
       Lang is a language-dependent environment variable  
       Mail refers to the current user's message store directory

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.