用户账号概述
用户账号概述
1.用户账号:
- 超级用户 root
- 普通用户
- 程序用户
2.UID:用户标识号
用户账号文件 /etc/passwd
保存用户名称、宿主目录、登录shell等基本信息,每一行对应一个用户的账号信息
实例:
[root@test1 test]# head -2 /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
[root@test1 test]# tail -5 /etc/passwd
pulse:x:497:496:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin
test:x:500:500:test:/home/test:/bin/bash
bourn:x:501:501::/home/bourn:/bin/bash
[root@test1 test]#
用户账号 | 密码占位符 | 用户账号ID | 组账号ID | 用户说明 | 宿主目录 | 登录shell |
---|---|---|---|---|---|---|
root | :x | :0 | :0 | :root | :/root | :/bin/bash |
用户账号文件 /etc/shadow
保存用户的密码、账号有效期等信息,每一行对应一个用户的密码记录
实例1:
[root@test1 test]# head -2 /etc/shadow
root:$6$lGd5CYh9d2amURES$lrWrgo5ME1Jeu9XprFhWYojxfVmE9Il9lUdVdEp/wNjzE.Avz7nDHT4WrIIDf22hxYfkEOKOpYPE2prC6LNJc/:16944:0:99999:7:::
bin:*:15980:0:99999:7:::
[root@test1 test]# tail -2 /etc/shadow
test:$6$WkBHrf4CJ.pf26uC$NJsmVivVIUdG1/J65VnEbezF6I/3GuKCFmf/J2rc.9vCPSC9Y6/ZSbJ9WDc3TVIz8dfKVTs8R96a4Pa/1Ezgq1:16944:0:99999:7:::
bourn:$6$j0ow0jpL$bS0xqQt70f3NCR5zYFoMxWUa52mMIVWHht9UHNwi5uEKXPP..H071LAfX81jW9AUWctcnfri.VwFxfcu/BULR/:16953:0:99999:7:::
[root@test1 test]#
- 16944——最近一次修改密码距离1970年,1月1号的天数。
- $6$WkBHrf4CJ.pf26uC$NJsmVivVIUdG1/J65VnEbezF6I /3GuKCFmf/J2rc.9vCPSC9Y6/ZSbJ9WDc3TVIz8dfKVTs8R96a4Pa/1Ezgq1——加密的密码。
- 16944后面的“0”是指几天内不能修改密码。例如5天,就是5天之内不能修改密码。
- 99999——密码使用的有效时间。
- 7——密码过期前7天提示你密码要过期。
Option | Purpose |
---|---|
-d | YYYY-MM-DD Sets the last change date for a password; output shown in /etc/shadow as the number of days after January 1, 1970. |
-E | YYYY-MM-DD Assigns the expiration date for an account; output shown in /etc/ shadow as the number of days after January 1, 1970. |
-I | num Locks an account num days after a password has expired; can be set to |
-1 | to make the account permanent. |
-l | Lists all aging information. |
-m | num Sets a minimum number of days that a user must keep a password. |
-M | num Sets a maximum number of days that a user is allowed to keep a password; can be set to -1 to remove that limit. |
-W | num Specifies the number of days before a password must be changed; a user is warned at that time. |
/etc/skel
File | Purpose |
---|---|
.bashrc | This basic bash configuration file may include a reference to the general /etc/bashrc configuration file. Can include commands to run when the bash shell is started. One example is an alias such as rm=’rm -i’. |
.bash_logout | This file is executed when you exit a bash shell and can include commands appropriate for this purpose, such as commands for clearing a screen. |
.bash_profile | Configures the bash startup environment. Appropriate place to add environment variables or modify the directories in your user account PATH. |
.gnome2/ | Includes settings for the GNOME Desktop Environment |
.kde/ | Specifies settings for the K Desktop Environment. Not added to /etc/skel and not copied to user home directories if KDE is not installed. |
.mozilla/ | Includes options associated with the Firefox web browser, developed by the Mozilla project. |