20180920 rzsz Transfer Files, User and User Group Related Profiles and Management

Keywords: Linux Windows shell yum

Using rz and sz to transfer files between Linux and Windows

[root@centos01 ~]# yum install -y lrzsz  # Installation Tools
sz test.txt # Pop up a dialog box to pass to the selected path
rz # After returning, the corresponding file is selected from the dialog box and passed to the current directory of linux

Linux to Windows

Windows passed to Linux

User profile and password profile

/etc/passwd user's password profile
Each user on a line in the file contents

[root@centos01 ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
...

A colon separates each line into seven segments, meaning the following

Paragraph 1: User name
Paragraph 2: Now all x, original stored password, password not put here for security reasons
Paragraph 3: User id, uid
Paragraph 4: Group id, gid
Paragraph 5: Note information
Paragraph 6: Home directory
Paragraph 7: User's shell for interactive terminals after login.Where/sbin/nologin indicates that the user cannot log on

/etc/shadow Configuration file that controls user passwords, with lines corresponding to one in/etc/passwd

[root@centos01 ~]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
...

Each line is separated by a colon in nine paragraphs, meaning the following

Paragraph 1: User name
Paragraph 2: Password (after encryption).The passwords of both users are not identical in/etc/shadow, even if they are identical.
Paragraph 3: Days, how many days from 1970.1.1 the last password change
Paragraph 4: Days, how many days before you can change your password, 0 means unlimited
Paragraph 5: Days, how many days must the password be changed
Paragraph 6: Days, how many days after password expiration prompt
Paragraph 7: Days, how many days after the password expires the account is disabled
Paragraph 8: Days, Account Lifecycle, Days After 1970.1.1 Paragraph 9: Reserved fields, not specific

User Group Management

/etc/group user group profile
/etc/gshadow group password profile

# Files backed up by the system when files with -
[root@centos01 ~]# ls /etc/shadow
shadow   shadow-   
[root@centos01 ~]# ls /etc/gshadow
gshadow   gshadow- 


[root@centos01 ~]# groupadd grouptest01 # Add group name is grouptest01 user group
[root@centos01 ~]# tail -n1 /etc/group
grouptest01:x:1003:

[root@centos01 ~]# groupadd -g 1004 grouptest02 #Specify gid add user group
[root@centos01 ~]# tail -n1 /etc/group
grouptest02:x:1004:

[root@centos01 ~]# groupdel grouptest02  # Delete group grouptest2
[root@centos01 ~]# tail -n2 /etc/group
slocate:x:21:
grouptest01:x:1003:

[root@centos01 ~]# tail -n4 /etc/group
test01:x:1001:
test02:x:1002:
slocate:x:21:
grouptest01:x:1003:
[root@centos01 ~]# groupdel test01  # You cannot delete a group as long as there are users in it
groupdel: User cannot be removed. test01"Master Group 

user management

[root@centos01 ~]# useradd test03  # Add a user named test03
[root@centos01 ~]# tail -n2 /etc/passwd
test02:x:1002:1002::/home/test02:/bin/bash
test03:x:1003:1004::/home/test03:/bin/bash

# User groups that specify users when adding users
[root@centos01 ~]# useradd -u 1004 -g grouptest01 test04
[root@centos01 ~]# tail -n3 /etc/passwd
test02:x:1002:1002::/home/test02:/bin/bash
test03:x:1003:1004::/home/test03:/bin/bash
test04:x:1004:1003::/home/test04:/bin/bash

# Specify user groups, home directories (-d), shell s (-s) when adding users  
[root@centos01 ~]# useradd -u 1005 -g grouptest01 -d /home/test05 -s /sbin/nologin test05
[root@centos01 ~]# tail -n3 /etc/passwd
test03:x:1003:1004::/home/test03:/bin/bash
test04:x:1004:1003::/home/test04:/bin/bash
test05:x:1005:1003::/home/test05:/sbin/nologin

# Adding users does not create a home directory.!!!! Users have a home directory, although no home directory has been created.!!!
[root@centos01 ~]# useradd -M test06
[root@centos01 ~]# !tail
tail -n3 /etc/passwd
test04:x:1004:1003::/home/test04:/bin/bash
test05:x:1005:1003::/home/test05:/sbin/nologin
test06:x:1006:1006::/home/test06:/bin/bash
[root@centos01 ~]# ls /home/
snowball  test01  test02  test03  test04  test05


[root@centos01 ~]# ls /home/
snowball  test01  test02  test03  test04  test05
[root@centos01 ~]# 
[root@centos01 ~]# userdel test05 # Delete the user without deleting the user's home directory
[root@centos01 ~]# ls /home/
snowball  test01  test02  test03  test04  test05  

[root@centos01 ~]# userdel -r test04 # Delete the user and the corresponding home directory
[root@centos01 ~]# ls /home/
snowball  test01  test02  test03

Posted by electrix on Sun, 19 May 2019 10:24:11 -0700