Centos 7 學習之添加使用者

來源:互聯網
上載者:User

標籤:centos

在使用 Centos 之前用的更多是Ubuntu,所以在 useradd 和 adduser 兩條命令出現歧義,在Ubuntu系統上這是兩條命令,而在Centos上則是同一條命令,adduser 是連結的形式存在

# ll /usr/sbin/ | grep userlrwxrwxrwx. 1 root root           7 10月 30 17:09 adduser -> useradd-rwxr-x---. 1 root root      114064 6月  10 09:16 useradd
1、添加使用者,Centos 沒有任何互動動作!建立使用者完畢後,必須修改密碼否則無法登陸
# useradd dev #建立使用者# passwd dev #修改密碼更改使用者 dev 的密碼 。新的 密碼:重新輸入新的 密碼:passwd:所有的身分識別驗證令牌已經成功更新。

2、為建立使用者添加 sudo 許可權,否則啥事都要請教 root 老大不合適,你懂得!

1)sudoers 檔案添加可寫入權限

# chmod -v u+w /etc/sudoers"/etc/sudoers" 的許可權模式保留為0640 (rw-r-----)
2)在 sudoers 檔案添加新使用者資訊到 ## Allow root to run any commands anywher 下,修改後的效果為
## Allow root to run any commands anywherroot    ALL=(ALL)       ALLdev     ALL=(ALL)       ALL #新增使用者資訊

3)取消 sudoers 檔案可寫入權限

# chmod -v u-w /etc/sudoersmode of "/etc/sudoers" changed from 0640 (rw-r-----) to 0440 (r--r-----)


Centos 7 學習之添加使用者

相關文章

聯繫我們

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