您的位置:首页 > 运维架构 > Linux

Linux 用户添加sudo权限

2016-10-28 11:20 627 查看
本文简单介绍下在Linux环境下如何创建一个用户并给此用户赋予sudo权限。

1 root创建测试用户test

[root@ha-4 ~]# useradd test

2 切换test用户检查sudo权限

[root@ha-4 ~]# su - test
[test@ha-4 ~]$ sudo date

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.

3 切换root用户用visudo添加test用户sudo权限

[root@ha-4 ~]# visudo通过visudo打开/etc/sudoers文件,添加以下行并保存
test    ALL=(ALL)       NOPASSWD: ALL

4 再次切换test用户检查sudo权限

[root@ha-4 ~]# su - test
[test@ha-4 ~]$ sudo date
Fri Oct 28 11:19:57 CST 2016
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: