標籤:使用者名稱 linux
linux下使用者的操作還是相對容易理解的,基本操作如下:
1、新增使用者
只有root使用者能建立新使用者
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
#useradd user1
建立後將會在/home目錄下產生一個與使用者名稱相同的使用者主目錄。
同時會建立一個新組,該組與該使用者同名,該使用者屬於該組的成員。
如果讓新的使用者歸屬於一個已經存在的組,使用如下命令:
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
#useradd -g usergroup1 user1
這樣該使用者就屬於usergroup1組的一員了。
如果想讓其再屬於一個組usergroup2,那麼使用:
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
#useradd -G usergroup2 user1
使用passwd命令為其設定一個初始密碼,新使用者才能進行登入:
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
#passwd user1
2、刪除使用者
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
userdel <使用者名稱>
將系統上的檔案也刪除掉,可以使用
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
userdel-r使用者名稱
3、新增組
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
groupadd<組名>
4、刪除群組
[plain] view plaincopy650) this.width=650;" src="https://code.csdn.net/assets/CODE_ico.png" width="12" height="12" alt="在CODE上查看代碼片" style="border:none;" />650) this.width=650;" src="https://code.csdn.net/assets/ico_fork.svg" width="12" height="12" alt="派生到My Code片" style="border:none;" />
-
groupdel <組名>
The end ...
650) this.width=650;" src="http://images.cnitblog.com/blog/437282/201411/041405283617635.gif" width="200" />
萌萌的IT人
linux下建立與刪除使用者詳細步驟