华南俳烁实业有限公司

考試首頁(yè) | 考試用書 | 培訓(xùn)課程 | 模擬考場(chǎng) | 考試論壇  
  當(dāng)前位置:Linux認(rèn)證 > 紅帽認(rèn)證 > 紅帽認(rèn)證輔導(dǎo) > 文章內(nèi)容
  

RHCE7認(rèn)證學(xué)習(xí)筆記:管理用戶和用戶組

來(lái)源:Linux社區(qū) [ 2016年2月16日 ] 【

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ù),基于安全考慮;

RHCE7認(rèn)證學(xué)習(xí)筆記5——管理用戶和用戶組

不為用戶創(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ù)

RHCE7認(rèn)證學(xué)習(xí)筆記5——管理用戶和用戶組

添加用戶: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

首頁(yè) 1 2 尾頁(yè)
本文糾錯(cuò)】【告訴好友】【打印此文】【返回頂部
將考試網(wǎng)添加到收藏夾 | 每次上網(wǎng)自動(dòng)訪問(wèn)考試網(wǎng) | 復(fù)制本頁(yè)地址,傳給QQ/MSN上的好友 | 申請(qǐng)鏈接 | 意見(jiàn)留言 TOP
關(guān)于本站  網(wǎng)站聲明  廣告服務(wù)  聯(lián)系方式  站內(nèi)導(dǎo)航  考試論壇
Copyright © 2007-2013 中華考試網(wǎng)(Examw.com) All Rights Reserved
隆子县| 贵德县| 民权县| 青州市| 武穴市| 昌图县| 浑源县| 成安县| 游戏| 绥江县| 浏阳市| 门头沟区| 福建省| 隆昌县| 玉树县| 宁波市| 浏阳市| 科技| 普陀区| 鲁山县| 安远县| 靖西县| 平远县| 工布江达县| 昌宁县| 甘谷县| 宣威市| 司法| 榆林市| 建始县| 三河市| 绥中县| 双鸭山市| 沙河市| 长葛市| 大埔区| 邳州市| 杂多县| 西吉县| 新乡市| 渝中区|