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
更改完毕linux 给用户分配权限linux find,如今可以用test2账号登陆linux 给用户分配权限,之后用命令su-linux认证,即可获得root权限进行操作。
2,编辑sshd_config文件使新建的用户可以通过ssh登陆:
vi /etc/ssh/sshd_config
添加
AllowUsers root@192.168.1.32 admin
多个用户用空格隔开。