增加使用者並賦於root許可權

2021-09-02 21:02:46 字數 847 閱讀 3727

usergroup wen

useradd wen -g wen

passwd wen

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

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

passwd: all authentication tokens updated successfully.

2、賦予root許可權

/etc/sudoers 黙失唯讀,在root使用者下可用wq!命令強制儲存

方法一:修改 /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帳號登入,然後用命令 sudo – ,即可獲得root許可權進行操作。

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

tommy:x:0:33:tommy:/data/webroot:/bin/bash

增加 刪除新使用者並新增root許可權

1.linux系統建立的普通使用者中,只有第乙個使用者具有root許可權,隨後新建的使用者均沒有root許可權。2.建立乙個新使用者lilei sudo adduser lilei 3.ls home可以發現我們已經建好了乙個新使用者 4.切換登入使用者 su l lilei 5.退出當前使用者 e...

centos增加乙個使用者並給root許可權方法

開始 測試環境 centos 5.5 1 新增使用者,首先用adduser命令新增乙個普通使用者,命令如下 adduser tommy 新增乙個名為tommy的使用者 passwd tommy 修改密碼 changing password for user tommy.new unix passwo...

Linux建立使用者並賦予Root許可權

新增普通使用者 root server useradd test 新增乙個名為test的使用者 root server passwd test 修改密碼 changing password for user test.new unix password 在這裡輸入新密碼 retype new uni...