Implementation scheme of linux and windows file transfer

  • 2020-11-18 06:34:23
  • OfStack

1. linux and windows file transfer (provided: XShell or securecrt must be used, PuTTY cannot be used)

yum install -y lrzsz //linux/windows file interchange requires yum to install lrzsz on linux

sz file name //linux file name to windows

rz Enter, select File //windows to upload to linux to the current directory

xshell and securecrt support;
putty does not support

2. User profile and password profile


[root@linux-01 ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash // Use: is divided into 7 Period of   Username: Represents password: UID Group: ID : User comment Information: User home directory: user shell
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin

The real password of linux system is stored under /etc/shadow, but the password is encrypted.
[root@linux-01 ~]# cat /etc/shadow
root: $6 $$KBV252Z71EgreUGmWbXKeI9Yo3PQ9RTpl3 NlEjlezY lXSIS0QDZWKTCGUIT3Yc7cBzJBfdX5Lv0. kJWEtlrSjadIFs4P0:17622:9999-7:0:9: : / / etc shadow etc/passwd 11 corresponds to the following file
bin: : 17110:9999-7:0:9: : / / use: divided into section 9 of the username: user password: change password last time from January 1, 1970: how many days need how many days to modify the password: password due: how many days how many days prior to the expiry of the password warning: how many days the password expired yet you did not change the password, the password will be locked: an account of the life cycle: keep field
daemon::17110:0:99999:7:::
adm:*:17110:0:99999:7:::

[root@linux-01 ~]# head -n1 /etc/shadow; tail -n2 /etc/shadow
Display both the first and last two lines of a file: head-n1 file path; tail -n2 file path

3. User group management


[root@linux-01 ~]# ls /etc/shadow
shadow shadow- // The file with minus sign is backed up automatically by the system 1 Copy, if you do not want to delete the user file, you can copy 1 Use the same document with a minus sign 
[root@linux-01 ~]# ls /etc/gshadow
gshadow gshadow-
[root@linux-01 ~]# ls /etc/passwd
passwd passwd-
[root@linux-01 ~]# ls /etc/group
group group-

Add the group


[root@linux-01 ~]# groupadd grp1 // add grp1 group 
[root@linux-01 ~]# tail -n1 /etc/group // To view group File the last 1 line 
grp1:x:1003:
[root@linux-01 ~]# groupadd -g 1005 grp2 // Add and specify grp2 The set of ID for 1005
[root@linux-01 ~]# tail -n3 /etc/group // To view group File the last 3 line 
slocate:x:21:
grp1:x:1003:
grp2:x:1005:

Delete the group
[root @linux-01 ~]# groupdel grp1 // Delete grp1 group
Note: empty groups can be deleted, and those with users under the group cannot be deleted

4. User management

Add user


[root@linux-01 ~]# useradd user3 // add user3 The user 
[root@linux-01 ~]# tail -n2 /etc/passwd 
hll:x:1001:1002::/home/hll:/bin/bash
user3:x:1002:1006::/home/user3:/bin/bash

Add and specify UID and groups


[root@linux-01 ~]# useradd -u 1004 -g grp2 user4 // add user4 User and specify UID for 1004 , added to the grp2 group 
[root@linux-01 ~]# tail -n3 /etc/passwd
hll:x:1001:1002::/home/hll:/bin/bash
user3:x:1002:1006::/home/user3:/bin/bash
user4:x:1004:1005::/home/user4:/bin/bash

Add a user and specify a home directory

[root@linux-01 ~]# useradd -u 1010 -g grp2 -d /home/user3 -s /sbin/nologin user6

-ES112en option: Add user but do not create user home directory

[root@linux-01 ~]# useradd -M user7 //添加user7用户但不创建它的家目录

Delete user

[root@linux-01 ~]# userdel user3 // Delete user3 user, but do not delete the user's home directory

-ES126en option: Delete the user's home directory while deleting the user


[root@linux-01 ~]# userdel -r user4
[root@linux-01 ~]# ls /home
hll user1 user3


Related articles: