Linux entry 3: user and user group management commands

Source: Internet
Author: User

Because there are many Linux commands and many options, you can only master some common commands to learn:

 

User and user group management commands
1. useradd command
Useradd Add a user
-G indicates the Primary Group of the user.
-G: Specifies the secondary group of the user.
-D. Specify the Home Directory of the user.
-P specifies the password of the user.
Useradd wtang-G oinstall-g dba-D/home/Oracle-P wtang
This statement creates a user wtang and the user's first group is oinstall
The secondary group is dBA, and the home directory is/home/wtang and the password is wtang.
2. userdel command
Delete an existing account.
Userdel Username
3. groupadd command
The groupadd password allows you to create a new user group. The basic usage is as follows:
Groupadd group name
4. groupdel command
The groupdel command is used to delete an existing user group.
Groupdel group name
5. passwd command
The passwd command allows you to change your password.
Super Users can also modify passwords of other users:
The passwd user name and password must comply with the specifications before modification
6. su command
The su command can be switched back and forth between users.
For example, to operate Oracle, you must use
Su-Oracle and Su Oracle do not need to add-the environment can be taken over, without adding the user's environment.
7. chomd command
The chmod command is very important for changing the access permissions of files or directories.
Its setting usage: chmod [who] [+ |-| =] [mode] File Name
1. The operation object who can be any of the following letters or their combination
U indicates the user as the owner of the file or directory.
G indicates the same group user, that is, all users with the same group ID as the file owner.
O indicates other (Others) Users
A Indicates all (all) users. It is the default value of the system.
2. The operation symbol can be
+ Add a permission
-Cancel a permission.
= Grant the given permission and cancel all other Permissions
3 mode indicates that common permission parameters include
R readable
W writable
X executable
1. Set the script permission to executable. The command is as follows:
Chomd = RX text
2. Set the file text permission to the same group as the file owner's primary readable and writable executable.
The command is as follows:
Chmod u = rwx, G = r, O = text note, followed by no space o = followed by Spaces
3. Assign permissions to files
Chomd ug + x text
Chomd ug = RTX text
8. CHOWN command
Chown is also frequently used to change the owner and group of a file or directory. For example
The root user copies a file of his own to the user oracle, in order to allow the user oracle to save
The root user of this file should set the owner of this file to Oracle. Otherwise, the user oracle
The basic usage of chown is
Chown [user: Group] File
Example:
Chown ORACLE: DBA text
Chown-r ORACLE: DBA/fssi/APP/Oracle/admin/dzdacs/dpdump

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.