File transfer between linux and windows, user configuration files and password configuration files, user group management, user management

File transfer between linux and windows, user configuration files and password configuration files, user group management, user management

2.27 File transfer between linux and windows

lrzsz can be installed on the server when using Xshell

sz test.txt     --传文件至windows
rz              --打开文件选择窗口,用于传文件至服务器

3.1 User Profiles and Password Profiles

User profile /etc/passwd

[root@24centos7-01 ~]# head -n5 /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
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin

[root@24centos7-01 ~]# tail -n15 /etc/passwd
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:998:996:User for polkitd:/:/sbin/nologin
tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
chrony:x:997:995::/var/lib/chrony:/sbin/nologin
vitus:x:1000:1000::/home/vitus:/bin/bash
user1:x:1001:1001::/home/user1:/bin/bash
user4:x:1002:1003::/home/user4:/bin/bash

自行创建的用户ID是从1000开始,跟CentOS的500开头有所区别

Password configuration file /etc/shadow

[root@24centos7-01 ~]# tail -n5 /etc/shadow
user22:!!:17463:0:99999:7:::
user33:!!:17463:0:99999:7:::
user44:!!:17463:0:99999:7:::
user55:!!:17463:0:99999:7:::
user66:!!:17463:0:99999:7:::

3.2 User group management

increase group

[root@24centos7-01 ~]# groupadd grp1
[root@24centos7-01 ~]# tail -n2 /etc/group
slocate:x:21:
grp1:x:1002:
[root@24centos7-01 ~]# groupadd -g 1005 grp2
[root@24centos7-01 ~]# tail -n2 /etc/group
grp1:x:1002:
grp2:x:1005:

delete group

[root@24centos7-01 ~]# groupdel vitus
groupdel:不能移除用户“vitus”的主组
[root@24centos7-01 ~]# groupdel user1
groupdel:不能移除用户“user1”的主组
[root@24centos7-01 ~]# groupdel grp2
[root@24centos7-01 ~]# 
[root@24centos7-01 ~]# tail -n5 /etc/group
chrony:x:995:
vitus:x:1000:
user1:x:1001:
slocate:x:21:
grp1:x:1002:

3.3 User Management

Add user

[root@24centos7-01 ~]# useradd user4
[root@24centos7-01 ~]# tail -n3 /etc/passwd
vitus:x:1000:1000::/home/vitus:/bin/bash
user1:x:1001:1001::/home/user1:/bin/bash
user4:x:1002:1003::/home/user4:/bin/bash

[root@24centos7-01 ~]# tail -n5 /etc/group
vitus:x:1000:
user1:x:1001:
slocate:x:21:
grp1:x:1002:
user4:x:1003:

Manually specify uid,gid

[root@24centos7-01 ~]# useradd -u 1004 -g grp1 user5
[root@24centos7-01 ~]# tail -n5 /etc/passwd
chrony:x:997:995::/var/lib/chrony:/sbin/nologin
vitus:x:1000:1000::/home/vitus:/bin/bash
user1:x:1001:1001::/home/user1:/bin/bash
user4:x:1002:1003::/home/user4:/bin/bash
user5:x:1004:1002::/home/user5:/bin/bash

Manually specify uid, gid, home directory, login is not allowed

[root@24centos7-01 ~]# useradd -u 1006 -g grp2 -d /home/viuts_test -s /sbin/nologin user22
[root@24centos7-01 ~]# tail -n3 /etc/passwd
user4:x:1002:1003::/home/user4:/bin/bash
user5:x:1004:1002::/home/user5:/bin/bash
user22:x:1006:1004::/home/viuts_test:/sbin/nologin
[root@24centos7-01 ~]# ls /home
user1  user4  user5  vitus  viuts_test
When adding a user, the uid will be incremented according to the existing ID. When the uid is incremented, if the gid is not specified, the gid will be kept with the uid first. If the gid that is consistent with the uid already exists, then the gid will be incremented separately at this time.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325482530&siteId=291194637