Linux下修改新建使用者許可權

2021-07-05 17:02:06 字數 729 閱讀 1796

linux下使用useradd增加使用者,如果沒有特別的指定,該使用者指定組名也是使用者名稱,並且為一般使用者(沒有root使用者的許可權),不能ssh遠端登入。

[xuwangcheng14@root]# useradd test2

[xuwangcheng14@root]# id test2

uid=1009(test2) gid=1009(test2) groups=1009(test2)

1,可以在執行完useradd和passwd命令後,給使用者分配到root組,這樣建立的使用者就有root許可權了,具體步驟如下:

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

## allows people in group wheel to run all commands

%wheel    all=(all)    all

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

[xuwangcheng14@root]# usermod -g root test2
修改完畢,現在可以用test2帳號登入,然後用命令 su - ,即可獲得root許可權進行操作。

2,編輯sshd_config 檔案使新建的使用者可以通過ssh登入:

vi /etc/ssh/sshd_config
新增

allowusers [email protected] admin
多個使用者用空格隔開。

mysql新建使用者,修改許可權

檢視使用者 select from mysql.user新增使用者 create user li1 localhost identified by li123456 刪除使用者 drop user li1 localhost 修改使用者名稱 rename user li1 localhost to ...

linux 新建使用者設定許可權

檢視使用者組 在檔案etc group中檢視使用者組的配置檔案,其表示方法為 使用者組 使用者組口令 gid 該使用者組包含的所有使用者 例如 root x 0 adm x 4 syslog,ubuntu 新增使用者組 root許可權 groupadd 使用者組名 建立使用者 useradd 選項 ...

linux新建使用者及許可權

1 增加使用者 useradd test2 設定密碼 passwd yh test changing password for user test.new password retype new password passwd all authentication tokens updated su...