Groupadd 1. function
The Groupadd command is used to join the new group to the system.
2. Format
Groupadd [-G GID] [-o]] [-R] [-F] GroupName
3. Main parameters
-G GID: Specifies the group ID number.
-O: Allow group ID numbers, not unique.
-R: Add group ID number, less than 499 system account.
-F: When you join an existing group, the development program exits.
4. Application examples
Create a new group and set the group ID to join the system:
#groupadd-g 344 CJH
Creating a group ID (GID) in the/etc/passwd file at this point is a 344 item.
Useradd wrote
2. Use
The Useradd command is used to establish user accounts and create a user's starting directory, which is the ultimate user.
2. Format
Useradd [-D home] [-s Shell] [-c comment] [-m [k template]] [-f inactive] [e-expire] [-P passwd] [-R] Name
3. Main parameters
-C: Plus note text, note text saved in passwd's Notes bar.
-D: Specifies the starting directory for users to log in.
-D: Change preset values.
-e: Specifies the expiration date for the account, which is permanently valid by default.
-F: Specifies how many days after the password expires, the account is closed.
-G: Specifies the starting group to which the user belongs.
-G: Specifies the additional group to which the user belongs.
-M: Automatically create a user's login directory.
-M: Do not automatically create a user's login directory.
-N: Cancels the establishment of a group in the name of the user.
-R: Set up System account.
-S: Specifies the shell to use when the user is logged in.
-U: Specifies the user ID number.
4. Notes
Useradd can be used to create user accounts, he and AddUser commands are the same. After the account is built, then use passwd to set the password of the account. The account created using the Useradd command is actually saved in the/etc/passwd text file.
5. Application examples
Create a new user account and set the ID:
#useradd Caojh-u 544
It should be noted that the set ID value as much as possible to be greater than 500, so as not to conflict. Because Linux installation will create a number of special users, generally 0 to 499 of the value of the bin, mail, such as the system account.
#useradd oracle-g oinstall-g dba
A new Oracle user is created, which is initially owned by the Oinstall group and also belongs to the DBA group.
#useradd zcx-d/var/ftp/service-s/sbin/nologin
Cannot use shell, and its user directory to/var/ftp/service
Chown writes the way: chmod [-CFVR] [--help] [--version] Mode file ...
Description: Linux/unix file access rights are divided into three levels: file owners, groups, others. The use of chmod can be used to control how files are accessed by others.
The meter:
Mode: Permission set string, the format is as follows: [Ugoa ...] [[+-=][RWXX] ...] [,...] where u represents the owner of the file, G means that the owner of the file belongs to the same group (group), o means other people, and a says all three are.
+ means to increase permissions,-to indicate cancellation rights, = to represent a unique set of permissions.
R means readable, W is writable, X is executable, x means only if the file is a subdirectory or the file has been set to executable.
-C: Display the change action if the file permissions have actually changed
-F: Do not display error messages if the file permissions cannot be changed
-V: Show details of permission changes
-r: The same permission changes are made to all files under the current directory and subdirectories (that is, to be changed one at a time)
--HELP: Show Auxiliary Instructions
--version: Display version
Example: Set the file file1.txt to be readable by all people:
chmod ugo+r File1.txt
Set the file file1.txt to be readable by all people:
chmod a+r File1.txt
The file file1.txt and File2.txt are set to the owner of the file and are writable by the same group as which they belong, but others are not writable:
chmod ug+w,o-w file1.txt File2.txt
Set ex1.py as only the owner of the file can perform:
chmod u+x ex1.py
All files and subdirectories under the current directory are set to anyone can read:
Chmod-r A+r *
In addition chmod can also use numbers to indicate permissions such as chmod 777 file
Syntax is: chmod ABC file
Each of these a,b,c is a number, representing the permissions of user, Group, and other respectively.
R=4,w=2,x=1
To rwx the property is 4+2+1=7;
To rw-the property is 4+2=6;
To r-x the property is 4+1=5.
Example:
chmod a=rwx File
And
chmod 777 File
Same effect
chmod ug=rwx,o=x File
And
chmod 771 File
Same effect
If you use chmod 4755 filename, you can make this program have root permissions
Directive Name: Chown
Use Rights: Root
Use mode: chmod [-CFHVR] [--help] [--version] user[:group] File ...
Description: Linux/unix is a multiple-person work system, all files are owned by the owner. Using Chown, the owner of the file can be changed. Generally speaking, this instruction is only used by the System Manager (root), the general user does not have the authority to change other people's file owners, and does not have the authority to change their own file owners to others. Only the System Manager (root) has such permissions.
The meter:
User: New file owner user idgroup: The new owner of the file (group)-C: If the owner of the file has indeed changed, it will show the change action-F: If the file owner cannot be changed, do not display an error message-H: Change only for link (link) Rather than the file that link really points to-----show details of the owner change-r: The same owner change to all files in the current directory and subdirectories (that is, to be changed one at a time)--help: Show Auxiliary Instructions--version: Display version
Example:
To set the owner of the file file1.txt as the user of the Users group Jessie:
Chown Jessie:users File1.txt
All files and subdirectories under the current directory are set up as users of the Users group Lamport:
Chmod-r Lamport:users *
-RW-------(600)--only the owner has read and write access.
-rw-r--r--(644)--only the owner has read and write access, while the group users and other users have access only.
-RWX------(700)--only the owner has the right to read, write and execute.
-rwxr-xr-x (755)--the owner has the right to read, write, execute, and the group of users and other users only read, execute permissions.
-rwx--x--x (711)-The owner has the right to read, write, execute, and the group of users and other users only execute permissions.
-rw-rw-rw-(666)-All users have file read and write permissions. This practice is not advisable.
-RWXRWXRWX (777)-All users have read, write, execute permissions. More undesirable approach.
The following are two common settings for a directory:
DRWX------(700)-only the owner can read and write in the directory.
Drwxr-xr-x (755)-All users can read the directory, but only owners can change the contents of the catalog
SUID's representative number is 4, like 4755, the result is-rwsr-xr-x.
Sgid's representative number is 2, like 6755, the result is-rwsr-sr-x.
Sticky Digit is 1, for example, 7755 is the result of-rwsr-sr-t
--------------------------------------------------------------------------------------------------
passwd user, modify user password