linux賦予普通使用者root許可權

2021-07-29 09:47:05 字數 1103 閱讀 1311

**:

《**開始》

測試環境:centos 5.5

1、新增使用者,首先用adduser命令新增乙個普通使用者,命令如下:

#adduser tommy 

//新增乙個名為tommy的使用者

#passwd tommy   //修改密碼

changing password for user tommy.

new unix password:     //在這裡輸入新密碼

retype new unix password:  //再次輸入新密碼

passwd: all authentication tokens updated successfully.

2、賦予root許可權

方法一: 修改 /etc/sudoers 檔案,找到下面一行,把前面的注釋(#)去掉

## allows people in group wheel to run all commands

%wheel    all=(all)    all

然後修改使用者,使其屬於root組(wheel),命令如下:

#usermod -g root tommy

修改完畢,現在可以用tommy帳號登入,然後用命令su –,即可獲得root許可權進行操作。

方法二: 修改 /etc/sudoers 檔案,找到下面一行,在root下面新增一行,如下所示:

## allow root to run any commands anywhere

root    all=(all)     all

tommy   all=(all)     all

修改完畢,現在可以用tommy帳號登入,然後用命令 su – ,即可獲得root許可權進行操作。

方法三: 修改 /etc/passwd 檔案,找到如下行,把使用者id修改為 0 ,如下所示:

tommy:x:500:500:tommy:/home/tommy:/bin/bash

修改後如下

tommy:x:0:500:tommy:/home/tommy:/bin/bash

儲存,用tommy賬戶登入後,直接獲取的就是root帳號的許可權。

《**結束》

Linux 賦予普通使用者root 許可權

linux的普通使用者在安裝一些東西的時候或者執行命令的時候,終端始終會提示許可權不夠,我們會將這個普通使用者賦予root許可權,但是,和root還是有區別的,因為只能執行root規定好的一些操作命令。adduser claire 新增乙個名為claire的使用者 passwd claire cha...

Linux 賦予普通使用者root 許可權

adduser 360mini 新增乙個名為360mini的使用者 passwd 360mini change the password changing password for user 360mini new unix password input new password retype ne...

賦予普通使用者root許可權

1 新增使用者,首先用adduser命令新增乙個普通使用者,命令如下 adduser tom 新增乙個名為tom的使用者 passwd tom 修改密碼 changing password for user tom.new unix password 在這裡輸入新密碼 retype new unix...