- Users and Groups
# id
可以查詢某人或自己的相關 UID/GID 等資訊
# ps au
觀察系統所有的程序資料
The format of /etc/passwd follows:
username:password:UID:GID:GECOS:/home/dir:shell
Like users, groups have a name and a number(GID).
Local groups are defined in /etc/group.
The format of /etc/group follows:
groupname:password:GID:list of users in this group
- Gaining Superuser Access
# su -
切換成 root 使用者
# su <username>
切換成 <username> 使用者
# sudo command
Running commands as root with sudo
※ One additional benefit to using sudo is that all commands executed using sudo are logged by default to /var/log/secure.
※ In Red Hat Enterprise Linux 7, all members of group wheel can use sudo to run commands as any user, including root. - Managing Local User and Group Accounts
- Managing User Passwords
Shadow passwords and password policy
# cat /etc/shadow
The format of /etc/shadow follows:
name:password:lastchange:minage:maxage:warning:inactive:expire:blank
Password aging
# chang <username>