Ubuntu-10.10如何給使用者新增sudo許可權
阿新 • • 發佈:2019-02-04
Ubuntu-10.10系統安裝過程中,系統會提示建立一個預設使用者,比如使用者名稱為:xuwei。
這個預設使用者具有一定的管理功能,即可以通過sudo命令執行root許可權的操作。由於Ubuntu系統不允許通過root使用者登入系統,所以這個預設使用者即是實際意義上的管理員。
現在的問題是:如果新建一個使用者:hadoop,然後要將此使用者設定為與xuwei相同的管理員使用者。
此問題有2種方式實現:
1.介面方式。
用xuwei登入系統,通過選擇選單:系統->系統管理->使用者和組,選擇hadoop使用者,更改賬戶型別為:管理員。然後重啟電腦,用hadoop使用者登入即可。
2.命令列方式。
用xuwei登入系統,開啟終端執行:
- sudo gedit /etc/sudoers
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL) ALL
# Allow members of group sudo to execute any command
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
hadoop ALL=(ALL) ALL
然後重啟電腦,用hadoop使用者登入即可。
附:建立hadoop使用者並將其新增到hadoop組中去到方法
首先建立hadoop組,命令如下:
- sudo addgroup hadoop
- sudo adduser --ingroup hadoop hadoop
如果我們要是hadoop使用者能夠使用sudo命令,那麼就按照上面描述進行操作。我是使用第二種方法。