linux使用者管理 centos

2021-09-12 13:53:27 字數 1422 閱讀 9878

1. 新增使用者

useradd [options] username

-d 家目錄

-d 更改預設

-e 指定新使用者的實效時間

-f 指定密碼過期多少天後關閉該使用者

-g 指定使用者所屬主組

-g 指定使用者所屬附屬組

-m 自動建立使用者目錄

-m 不建立使用者目錄

-r 建立系統目錄

-u 指定uid

-s 指定使用者shell

2. 修改使用者屬性

usermod [options] username

-a 把使用者加入組,與-g一起使用

-c 描述,/etc/passwd第五個字段

-d 使用者目錄

-e 指定使用者過期時間,yy-mm-dd

-f 過期後多少天禁用此使用者,0表示過期立刻禁用,-1表示禁用此功能

-g 主組

-g 附屬組

-l 鎖定使用者密碼

-m 修改使用者家目錄,通常和-d一起用

-s 修改shell

-u 修改uid

-g 修改gid

3. 新增組

groupadd [options] groupname

-f 如果組已經存在,則以執行成功的方式退出

-g gid

-o 允許新增乙個不唯一的gid

-r 建立乙個系統組

配置檔案

/etc/passwd

root:x:0:0:root:/root:/bin/bash

1. 註冊名

2. 使用者密碼標示符

3. 使用者id

4. 組id

5. 使用者名稱

6. 使用者目錄

7. 使用者shell

/etc/group

root:x:0:test

1. 組名

2. 組密碼標示符

3. 組id

4. 該組的使用者

/etc/shadow

test_ansible:!!:17969:0:99999:7::17895:

1. 使用者名稱

2. 加密後的密碼

3. 最近改動密碼的日期

4. 密碼不能變更的時常

5. 在多長時間內必須更改密碼

6. 密碼過期預警天數

7. 密碼過期之後多少天,使用者可以繼續用的天數

8. 使用者實效日期

Linux使用者管理(centos)

useradd testuser 新增使用者 testuser為使用者名稱 passwd testuser 修改使用者密碼 提示兩次輸入密碼 賦予root許可權 修改 etc sudoers 檔案,找到下面一行,在root下面新增一行,如下所示 allow root to run any comma...

Centos學習筆記 linux使用者管理

2012 3 2 linux使用者管理 使用者資訊檔案 etc passwd 密碼檔案 etc shadow 使用者組檔案 etc group 使用者組密碼檔案 etc gshadow 使用者配置檔案 etc login.defs etc default useradd 新使用者資訊檔案 etc s...

LInux 使用者管理

最近在使用nagios的時候,需要新增一些使用者和組的資訊。需要整理一下,有些記不清楚了。原文連線 http www.g loaded.eu 2005 11 06 manage users from the command line userinfo 使用者資訊 命令id 顯示使用者基本資訊 命令u...