天天看點

linux設定普通使用者的root權限

1.添加使用者,可用adduser指令添加一個普通使用者,指令如下:

# adduser user1                        //添加一個名為user1的使用者

2.設定使用者密碼

# passwd user1                        //設定/修改使用者user1的密碼

3.設定root權限,我在這采用的是修改  /etc/sudoers 檔案,找到下面這行

## Allow root to run any commands anywhere

在     root    ALL=(ALL)       ALL  這一行下面添加一行

    user1   ALL=(ALL)       ALL

儲存修改即可。

4.我們在使用普通使用者時,有時候需要經常使用root權限,這時需要我們經常輸入使用者的密碼,如果不想經常輸入密碼的話,可選擇這一操作:

仍然是修改  /etc/sudoers 檔案,找到  ## Same thing without a password  這一行,在下面添加一行

user1    ALL=(ALL)      NOPASSWD: ALL

儲存修改。這樣在普通使用者使用root權限時就不用輸入密碼啦  *罒▽罒*

繼續閱讀