CentOS實驗二:添加操作員帳號

來源:互聯網
上載者:User

因為root使用者對系統具有全權的操作許可權,為了避免一些失誤的操作,建議在一般情況下,以一般使用者登入系統,必要的時候需要root操作許可權時,再通過“su -”命令來登入狀態root使用者進行操作。

 

1. 建立amonest帳號:

[root@localhost ~]# useradd amonest

 

2. 設定amonest密碼:

[root@localhost ~]# passwd amonestChanging password for user amonest.New password:             ##輸入密碼,不會顯示Retype new password:      ##再次輸入密碼,不會顯示passwd: all authentication tokens updated successfully.

 

3. 將amonest帳號加入到wheel組。

[root@localhost ~]# usermod -G wheel amonest

 

4. 配置只允許wheel這個組的使用者執行“su -”命令登入狀態root使用者,其他組的使用者即使執行“su -”、輸入了正確的root密碼,也無法登入狀態root使用者。開啟/etc/pam.d/su檔案,找到下面這一行,去掉前面的注釋後儲存:

#auth required pam_wheel.so use_uid

然後執行下面的命令:

[root@localhost ~]# echo "SU_WHEEL_ONLY yes" >> /etc/login.defs

 

OK,現在就可以登出root,用amonest登入了。需要root許可權的時候使用“su -”命令就行了。

 

參考串連:http://www.cnblogs.com/eastson/archive/2012/07/01/2572187.html

相關文章

聯繫我們

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