1、用戶和用戶組
/etc/passwd 文件記錄了所有用戶的相關(guān)信息
[root@clz ~]# 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
每一行代表一個(gè)用戶信息,從左至右分別代表了:用戶名,密碼(存儲(chǔ)在/etc/shadow,用x表示),UID,GID,用戶全稱,家目錄,shell;
如果要在圖形化界面下管理用戶與組,需安裝包:system-config-users-1.3.5-2.el7.noarch.rpm
如果一個(gè)用戶的shell指定為/sbin/nologin,此用戶成為匿名用戶,則此用戶無(wú)法登陸系統(tǒng),任何用戶也無(wú)法切換到它,一般用于系統(tǒng)的服務(wù),基于安全考慮;
不為用戶創(chuàng)建私人組的話,則默認(rèn)屬于user組;
RHEL6的UID 從500開始,RHEL7則是從1000開始;
一個(gè)用戶如果密碼被鎖定,則只有root用戶可以切換過(guò)去;
用戶密碼修改,可以使用passwd和chage來(lái)修改對(duì)應(yīng)的賬號(hào)屬性:
[root@clz ~]# passwd --help
Usage: passwd [OPTION...]
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only)
-l, --lock lock the password for the named account (root only)
-u, --unlock unlock the password for the named account (root only)
-e, --expire expire the password for the named account (root only)
-f, --force force operation
-x, --maximum=DAYS maximum password lifetime (root only)密碼使用最大天數(shù)
-n, --minimum=DAYS minimum password lifetime (root only)密碼使用最少天數(shù)
-w, --warning=DAYS number of days warning users receives before password expiration (root only) 密碼更換前警告的天數(shù)
-i, --inactive=DAYS number of days after password expiration when an account becomes disabled (root only)賬號(hào)被取消激活前的天數(shù),如果該值設(shè)置未負(fù)值,則表示賬號(hào)不鎖定,但是登陸時(shí)一定要修改密碼;
-S, --status report password status on the named account (root only)
--stdin read new tokens from stdin (root only)
[root@clz ~]# chage --help
Usage: chage [options] LOGIN
Options:
-d, --lastday LAST_DAY set date of last password change to LAST_DAY 修改密碼的時(shí)間戳
-E, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE密碼過(guò)期日期
-I, --inactive INACTIVE set password inactive after expiration
to INACTIVE 賬號(hào)被取消激活前的天數(shù)
-m, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS 密碼最少使用天數(shù)
-M, --maxdays MAX_DAYS set maximim number of days before password
change to MAX_DAYS密碼最大使用天數(shù)
-R, --root CHROOT_DIR directory to chroot into
-W, --warndays WARN_DAYS set expiration warning days to WARN_DAYS密碼更換前警告的天數(shù)
添加用戶:useradd/adduser
[root@clz ~]# useradd --helpOptions:
-c, --comment COMMENT GECOS field of the new account 全稱
-d, --home-dir HOME_DIR home directory of the new account 家目錄
-e, --expiredate EXPIRE_DATE expiration date of the new account
-g, --gid GROUP name or ID of the primary group of the new
account 主組
-G, --groups GROUPS list of supplementary groups of the new
account 子組
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory 不創(chuàng)建用戶家目錄
-p, --password PASSWORD 設(shè)置密碼
-s, --shell SHELL login shell of the new account 設(shè)置SHELL
-u, --uid UID user ID of the new account 指定UID
2015職稱計(jì)算機(jī)考試書PowerPoint2007中 .. 定價(jià):¥45 優(yōu)惠價(jià):¥42 更多書籍 | |
2015年全國(guó)職稱計(jì)算機(jī)考試教材(2007模 .. 定價(jià):¥225 優(yōu)惠價(jià):¥213 更多書籍 |