我们购买了Vultr VPS后,为了安全考虑,通常会先创建一个具有sudo权限的非根用户来管理服务器。Vultr VPS提供有多种Linux发行版选项,那么如何在CentOS上创建sudo权限用户?下面一起来看下主要步骤介绍。
Vultr主机商目前提供有“充多少送多少”超值优惠活动,新用户首充最高赠送100美元,有效期12个月,还是非常划算的。有需要的朋友,可以参考:《Vultr优惠码使用教程和优惠解读》
步骤1、首先使用SSH工具登录到Vultr VPS服务器上,登录信息一般可以在欢迎邮件中获得。成功登录服务器后,在命令行界面运行以下命令添加一个新用户example_user,并为其设置强密码。
# adduser example_user
# passwd example_user
Changing password for user example_user.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
步骤2、将新创建的用户example_user添加到Wheel Group中
# usermod -aG wheel example_user
步骤3、修改sudoers文件
执行visudo命令查看sudoers配置文件。
# visudo
查看group wheel,如果该行被禁用,则删除注释,然后保存文件。
## Allows people in group wheel to run all commands
%wheel ALL=(ALL) ALL
步骤4、切换到新用户
# su – example_user
使用whoami命令查看是否显示新用户名,并利用sudo whoami检查访问权限,返回结果应为root。
$ whoami
example_user
$ sudo whoami
[sudo] password for example_user:
root
(本文由美国主机侦探原创,转载请注明出处“美国主机侦探”和原文地址!)

微信扫码加好友进群
主机优惠码及时掌握

QQ群号:938255063
主机优惠发布与交流