標籤:
在Linux終端下如何增加刪除普通使用者帳戶
想瞭解Linux下的使用者資訊,主要兩個檔案:/etc/passwd和/etc/shadow
今天主要講一下用命令建立和刪除使用者
增加使用者
一般是兩個步驟,增加使用者名稱和指定使用者密碼
[[email protected] /]# useradd test2[[email protected] /]# passwd test2Changing password for user test2.New UNIX password:BAD PASSWORD: it does not contain enough DIFFERENT charactersRetype new UNIX password:passwd: all authentication tokens updated successfully.#下面這個命令是為使用者指定家目錄的[[email protected] home]# useradd test5 -d /home/t#更多詳細的參數man useradd
刪除使用者
刪除使用者比較簡單,預設不加參數,不會把使用者的家目錄刪除,
要刪除家目錄的時候,要加上-r參數
#預設沒有刪除家目錄[[email protected] home]# userdel test2[[email protected] home]# ls /homelele swap t t4 test2 test3#加上-r參數可以把家目錄也一併刪除[[email protected] home]# useradd test6[[email protected] home]# ls /homelele swap t t4 test2 test3 test6[[email protected] home]# userdel -r test6[[email protected] home]# ls /homelele swap t t4 test2 test3
Linux (CentOS)增加刪除使用者