11. Linux and Windows interoperability files, user profiles and password profiles, user group management, user management
One, Linux and Windows inter-pass files
Install package: Yum install-y Lrzsz (XSHELL,SECURECRT support, putty not supported)
After installation, you can use the command:
Linux to Windows:sz [file name]
The path that you saved to Windows appears, and you can customize it.
Windows passes to LINUX:RZ (r: Remote meaning)
Ii. user profile and password configuration file
1. User Configuration file/etc/passwd
useradd Command : Create User
Creating a user will add a line to this file.
Per user row, each line is separated by a colon for 7 segments:
First paragraph: User name
The second paragraph: an x, early is a password file to save the user.
Third paragraph: UID
Fourth paragraph: GID
The fifth paragraph: represents the user's annotation information, has no substantive effect.
Sixth paragraph: User home directory
The seventh paragraph: the user's shell (user login has an interactive terminal, can interact with the machine window is a shell, ordinary users and Root are/bin/bash, special users/sbin/sync and/sbin/shutdown, Common is/bin/bash and /sbin/nologin,
2. Password configuration file/etc/shadow
The file and user profile are the corresponding files that are specifically used to control the user's password, and are similar to the user profile, separated into nine segments by a colon:
First paragraph: User name
The second paragraph: User password, the real password of the account, the password is encrypted, but some hackers can still decrypt. So, set the file property to 000, and the single root account can be accessed and changed. Use Ls-l to view the permissions for the file. An encrypted password can be obtained in clear text, but cannot be obtained by encrypting the password in plaintext.
Third paragraph: the date the password was last changed. Number of days since January 1, 1970.
The fourth paragraph: how many geniuses can change the password, the default is 0, that is unrestricted.
Fifth: The number of days after the password expires, that is, in how long the password must be changed. For example, set to 30, you must change the password one time within 30 days, or you cannot log on to the system. The default is 99999, which is understood to never require a password change.
Sixth paragraph: The warning period before the password expires. If this setting is 7, it means that when the password expires after 7 days, a warning will be issued alerting the user that his password expires in 7 days.
Seventh paragraph: Account expiration period. If set to 3, it means that the password has expired, but the user did not change the password before expiry, then after three days, the account will expire, that is, locked.
Eighth paragraph: The statement period of the account. As in the third paragraph, this cycle is calculated by the number of days from January 1, 1970. The meaning is that the account can be used before this date and the account will be voided after the expiry.
The Nineth paragraph: as a reserved, meaningless.
Third, user group management
About groups of files:/etc/group, creating a user also creates a group that is the same as the user.
and/etc/shadow corresponding/etc/gshadow: The password profile for the group.
ls These files will appear a file with a minus sign, which is the corresponding file of the system automatic backup.
After you create or delete, you can view the cat into the configuration file/etc/group.
1. Command Groupadd for new group
Format: Group [-G GID] GroupName
# Group Grptest1
# Tail-n1/etc/group
GRPTEST1:X:1003:
If the-G option is not added, the group is created according to the system default GID. As with the UID, GID also starts from 1000. We can customize the GID as follows:
# groupadd-g 1008 Grptest2
# Tail-n2/etc/group
GRPTEST1:X:1003:
grptest2:x:1008:
2. Delete a group command Groupdel
]# Groupdel Grptest2
# Tail-n2/etc/group
YW01:X:1002:
GRPTEST1:X:1003:
Groupdel There is no special option, there is a situation can not delete the group, that is, there are accounts in the group, only delete the account before you can delete the group.
Iv. User Management
After you create or delete, you can view the cat into the configuration file/etc/passwd.
1. Add User's command Useradd
Format: Useradd [-u UID] [-G GID] [-D HOME] [-m] [-s] option can be added simultaneously in one line of command.
-U: Custom UID.
-G: To make the new user belong to a group that already exists, followed by the group ID, or with the group name.
-D: Customize the user home directory.
-M: Indicates that the home directory is not established.
-S: Custom shell.
Example New User:
# Useradd 007
# TAIL-N1/ETC/PASSWD
007:x:1002:1004::/home/007:/bin/bash
# Tail-n1/etc/group
007:X:1004:
Without any options, directly with the user name, a group with the same name as the user name is created. Many times you need to customize the Uid,gid or the owning group. If the-G option is followed by a non-existent GID, an error indicates that the group does not exist. The Add-M option does not create a home directory, but there is still a field in the/etc/passwd file, and if you use the command Ls/home/user to view it, you will be prompted that the directory does not exist. Therefore, the-m option simply does not create a directory.
2. Delete the user's command Userdel
Format: Userdel [-r] Username
The function of the-r option is to delete the user's home directory when the user is deleted. If not, the home directory will be retained.
Xi. Linux and Windows Interop files, user profile and password profiles, user group management, user management