用户/组基本概念
用户的作用
查看当前登录的用户信息:
[root@qianfeng ~]# id
uid=0(root) gid=0(root) groups=0(root)
查看文件的owner:
[root@qianfeng ~]# ll /home/
drwx------. 4 alice alice 4096 Jun 2 15:59 alice
drwx------. 2 root root 16384 Jun 1 23:09 lost+found
drwxr-xr-x 2 root root 4096 Jun 2 15:33 qianfeng
查看运行进程的username:
[root@qianfeng ~]# ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 19360 1536 ? Ss 13:29 0:00 /sbin/init
root 2 0.0 0.0 0 0 ? S 13:29 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 13:29 0:00 [migration/0]
root 4 0.0 0.0 0 0 ? S 13:29 0:00 [ksoftirqd/0]
用户组信息存储的文件:
用户基本信息文件
/etc/passwd(冒号分割为7列字段)
root:x:0:0:root:/root:/bin/bash
用户名:x:uid:gid:描述:HOME:shell
root:用户名:登录系统的名字
X:密码占位符:,具体内容不在这里
0:UID: 用户的身份证号
系统约定: RHEL7
uid: 0 特权用户
uid: 1~499 系统用户
uid: 1000+ 普通用户
0:GID:GROUP 组号
root:描述:比如经理 manager
/root:家目录:登录系统时,所在目录
/bin/bash:登录shell:命令解释器
用户密码信息文件
/etc/shadow(8列)
root:$1$MYG2N:15636:0:99999:7: : :
了解即可
加密算法$id$salt$encrypted
$1: MD5
$5: SHA-256
$6: SHA-512
root:$1$MYG2NDG6$a1wtyr5GDM2esAPjug0YP0:15636:0:99999:7:: :
1)“登录名”是与/etc/passwd文件中的登录名相一致的用户账号
2)“口令”字段存放的是加密后的用户口令字,如果为空,则对应用户没有口令,登录时不需要口令