linux创建新用户

1.添加用户

adduser test

设置密码

passwd test

2.添加root权限
(1):

chmod 755 /etc/sudoers
vi /etc/sudoers

文件,找到下面一行,把前面的注释(#)去掉

 Allows people in group wheel to run all commands
%wheel    ALL=(ALL)    ALL

然后修改用户,使其属于root组(wheel),命令如下:

usermod -g root test

修改完毕,现在可以用tommy帐号登录,然后用命令 su – ,即可获得root权限进行操作。

将sudoers权限改回原状

chmod 440 /etc/sudoers

(2)
在/etc/sudoers中添加
test ALL=(ALL) ALL

Allow root to run any commands anywhere
root    ALL=(ALL)     ALL
test   ALL=(ALL)     ALL

3.关闭root登陆
编辑配置文件

vi /etc/ssh/sshd_config

修改
PermitRootLogin后面的yes为no,
并且去掉前面的注释符,同时可以限制失败次数

以上

  • 4
    点赞
  • 77
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值