Centos下useradd,groupadd等的使用方法

來源:互聯網
上載者:User

標籤:groupadd   chage   chch   chfn   


 學習Linux下使用者以及組管理命令,下面開講。


Useradd:useradd - create    a new user or update default new user information

使用格式:useradd [options] LOGIN

-u    :後面接的是 UID,指定使用者UID。

-g    :後面接的是GID,指定使用者的有效組。

-G    :後面接的組名則是這個帳號可以加入的附加組。

-M    :強制!不要建立使用者家目錄!(系統帳號預設值)。

-m    :強制!要建立使用者家目錄!(一般帳號預設值)。

-d :指定某個目錄成為家目錄,而不用使用預設值。務必使用絕對路徑!

-r :建立一個系統帳號,這個帳號的    UID 會有限制 (參考    /etc/login.defs)

-s :後面接一個 shell ,若沒有指定則預設是 /bin/bash

相關檔案資訊:

使用者帳號密碼參數方面的檔案:/etc/passwd,    /etc/shadow

      使用者群組相關方面的檔案:/etc/group, /etc/gshadow

 

Passwd:passwd - update user’s    authentication tokens

使用格式: passwd  [options]...Name

-l:鎖定此賬戶

-u:解鎖此賬戶

--stdin: 使用前一個管道的資料,作為密碼的輸入

相關檔案資訊:/etc/pam.d/passwd

 

Chage:hage - change user password expiry    information

使用格式:chage    [options] [LOGIN]

  -d 0:表示使用者登入時必須修改密碼,才可以進入系統。

 

Usermod:usermod - modify    a user account

使用格式:usermod    [options] LOGIN

  -d:後面接使用者的家目錄,修改使用者家目錄

  -g:後面接使用者的有效組,修改有效組

  -G:後面接使用者的附加組,修改附加組

  -l:後面接使用者的帳號名稱,修改使用者名稱

  -s:修改shell

  -u:修改UID

  -L:將使用者鎖定

  -U:解鎖


Userdel:userdel - delete    a user account and related files

使用格式:userdel    [options] LOGIN

  -r:連同使用者家目錄一起刪除

 

Chfn:chfn - change your    finger information

使用格式:chfn [option]...username

  -f :後面接完整的大名

  -o :您辦公室房間號碼

  -p :辦公室的電話號碼

  -h :家裡的電話號碼

 

Chch:change shell

使用格式:chch [option]...username

  -l:列出系統可用shell

  -s:修改shell

 

Groupadd:groupadd - create a new    group

使用格式:groupadd    [options] group

  -g:指定組ID

  -r:建立系統群組

 

Groupmod:groupmod - modify    a group definition on the system

使用格式:groupmod    [options] GROUP

  -g:修改GID

  -n:修改組名

 

Groupdel:groupdel - delete    a group

使用格式:groupdel    group

 

Gpasswd:gpasswd - administer    /etc/group and /etc/gshadow

使用格式:gpasswd    [option] group

    :無參數,表示給組加密碼

  -A:指定群管理員

  -M:將帳號加入這個群組

  -r:將組密碼移除

  -R:讓組的密碼欄失效

#群組管理員的使用格式:

  -a:將使用者加入組

  -d:將使用者移除組


 

 

 


 


Centos下useradd,groupadd等的使用方法

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.