linux下建立與刪除使用者詳細步驟

來源:互聯網
上載者:User

標籤:使用者名稱   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;" />

  1. #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;" />

  1. #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;" />

  1. #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;" />

  1. #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;" />

  1. 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;" />

  1. 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;" />

  1. 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;" />

  1. groupdel <組名>  


The end ...

  • 上一篇linux下使用yum安裝svn詳解


650) this.width=650;" src="http://images.cnitblog.com/blog/437282/201411/041405283617635.gif" width="200" />

萌萌的IT人

linux下建立與刪除使用者詳細步驟

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.