普通用户添加sudo权限

1. 添加新用户

我们在Linux系统中经常需要根据不同的需求创建对应的新用户, 但是新用户作为一个普通用户, 权限是非常有限的, 默认不能够使用管理员权限执行某些管理员才能执行的命令, 给大家演示一下操作步骤:

SHELL
# 添加新用户 sanji
[root@VM-8-14-centos ~]# adduser sanji

# 给新用户 sanji 设置一个密码
[root@VM-8-14-centos ~]# passwd sanji
Changing password for user sanji.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

# 切换到 sanji 用户
[root@VM-8-14-centos ~]# su - sanji

# 让 sanji 用户执行一个只有管理员才有权限执行的操作, 因此需要在命令前加 sudo
[sanji@VM-8-14-centos ~]$ sudo updatedb

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for sanji: 
sanji is not in the sudoers file.  This incident will be reported.

最后命令还是没能够执行, 原因是没有权限, 最后提示告诉我们sanji is not in t

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

丁金金_chihiro_修行

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值