Linux and Windows inter-pass files
First install a package Lrzsz yum install-y lrzsz
Linux testb.txt to Windows
Windows transfers RZ to Linux
View/ect/passwd, Box is the newly added user
The first field is the user name, which is a string representing the user account.
The second field holds the password for the account. The discovery is all x. The early Unix system password was actually placed here, but for security reasons, it was later stored in the/etc/shadow, with only one x instead.
The third field is a number that represents the user ID, which is the UID. The system is using this number to identify the user identity. Here 0 is root, which means that the test user's UID is changed to 0, then the system will assume that root and test are the same user. 0 is the identification number of the superuser (root), and the normal user ID for CENTOS7 starts at 1000.
The fourth field identifies a group identification number, also known as GID. This field corresponds to a record in/etc/group. /etc/group and/etc/passwd are similar.
The fifth field is a comment description and has no practical significance. Some of the user's attributes, such as name, phone number, address, and so on, are usually logged.
The sixth field is the user's home directory, which is in this directory when the user logs in. Root's home directory is/root. Normal user's home directory is/home/username
The seventh field is the user's shell. After the user logs in, a process is initiated to pass the user-issued instruction to the kernel, which is the shell. View the/etc/passwd file, which has many/sbin/nologin in addition to/bin/bash, which indicates that the account is not allowed to log on.
/etc/shadow Controlling user passwords
The first field is the user name, which corresponds to the/etc/passwd.
The second field is the user password, which is the real password for the account. This password has been encrypted, but hackers can still decrypt it. Therefore, the file property is set to 000, but the root user can access the changed.
The LZP user password is changed to the same as the root password, but the/ect/shadow display is not the same, because it is encrypted.
The third field is the date the password was last changed.
The fourth field is much more genius. You can change the password by default, which is 0, which is unrestricted.
The fifth field is the number of days after which the password expires, that is, the day in which the password must be changed.
The sixth field is the warning period before the password expires. If this value is set to 7, then the system warns the user that the password expires after 7 days, and the password will expire after 7 days.
The seventh field is the expiration date of an account. If this value is set to 3, then the password has expired, but the user does not change the password before expiration, then after 3 days, the account will be invalid, that is, locked.
The eighth field is the life cycle of the account. It means that the account can be used before this date and the account will expire
The Nineth field, as a reservation, has no practical significance.
Command Groupadd for the new group
[[email protected] ~]# groupadd GRP1 Create group GRP1
[Email protected] ~]# Tail-n1/etc/group
GRP1:X:1004:
[[email protected] ~]# GROUPADD-G 1005 grp2 Create group Grp2 specify GID
[Email protected] ~]# Tail-n1/etc/group
GRP2:X:1005:
To delete a group command Groupdel
[[email protected] ~]# Groupdel GRP1 Delete GRP1 Group
[Email protected] ~]# Tail-n3/etc/group
TESTGROUP:X:1002:
LZP:X:1003:
GRP2:X:1005:
[[email protected] ~]# Groupdel LZP This group has no talent to delete, a group contains many Members
Groupdel:cannot Remove the primary group of user ' Lzp '
[Email protected] ~]# useradd user2
[Email protected] ~]# TAIL-N2/ETC/PASSWD
Lzp:x:1002:1003::/home/lzp:/bin/bash
User2:x:1003:1006::/home/user2:/bin/bash
[Email protected] ~]# TAIL-N4/ETC/PASSWD
Lizhipeng:x:1000:1000::/home/lizhipeng:/bin/bash
User1:x:1001:1001::/home/user1:/bin/bash
Lzp:x:1002:1003::/home/lzp:/bin/bash
User2:x:1003:1006::/home/user2:/bin/bash
Increase the user's command useradd
-U: Represents a custom UID
-G: Indicates that a new user belongs to a group that already exists, followed by the group ID, or with the group name.
-D: Represents the home directory of the custom user
-M: Indicates no home directory
-S: Indicates custom shell
[[email protected] ~]# useradd user2 Create user User2
[Email protected] ~]# TAIL-N2/ETC/PASSWD
Lzp:x:1002:1003::/home/lzp:/bin/bash
User2:x:1003:1006::/home/user2:/bin/bash
[Email protected] ~]# TAIL-N4/ETC/PASSWD
Lizhipeng:x:1000:1000::/home/lizhipeng:/bin/bash
User1:x:1001:1001::/home/user1:/bin/bash
Lzp:x:1002:1003::/home/lzp:/bin/bash
User2:x:1003:1006::/home/user2:/bin/bash
[[email protected] ~]# useradd-u 1004-g grp2 user3 Specify User3uid as 1004, owning group GRP2, i.e. GID and GRP2
[Email protected] ~]# TAIL-N3/ETC/PASSWD
Lzp:x:1002:1003::/home/lzp:/bin/bash
User2:x:1003:1006::/home/user2:/bin/bash
User3:x:1004:1005::/home/user3:/bin/bash
[Email protected] ~]# useradd-u 1006-g grp2-d/home/lizhipeng001-s/sbin/nologin user4 Specify user4uid=1006 gid=1005, home directory/ home/lizhipeng001 Custom Shell is/sbin/nologin
[Email protected] ~]# TAIL-N3/ETC/PASSWD
User2:x:1003:1006::/home/user2:/bin/bash
User3:x:1004:1005::/home/user3:/bin/bash
User4:x:1006:1005::/home/lizhipeng001:/sbin/nologin
[Email protected] ~]# ls/home/
Lizhipeng lizhipeng001 lzp Test user1 user2 User3
[[email protected] ~]# useradd-m user5-m Create user 5 without creating a home directory
[Email protected] ~]# TAIL-N3/ETC/PASSWD
User3:x:1004:1005::/home/user3:/bin/bash
User4:x:1006:1005::/home/lizhipeng001:/sbin/nologin
User5:x:1007:1007::/home/user5:/bin/bash
[[email protected] ~]# ls/home/not created User5
Lizhipeng lizhipeng001 lzp Test user1 user2 User3
Delete an account's command Userdel
The function of the Userdel [-r] Username,-r option is to delete the user's home directory when the user is deleted.
[Email protected] ~]# Useradd user12
[Email protected] ~]# Ls-ld/home/user12
DRWX------. 2 User12 user12 21:17/home/user12
[[email protected] ~]# Userdel user12 Delete user 12, home directory still exists
[Email protected] ~]# Ls-ld/home/user12
DRWX------. 2 1008 1008 21:17/home/user12
[[email protected] ~]# userdel-r user12-r, home directory does not exist
[Email protected] ~]# Ls-ld/home/user12
Ls:cannot access/home/user12:no such file or directory
Linux and Windows Interop file user profiles and password profiles user groups manage user management