rhel7 配置普通用户使用sudo
2016-03-12 14:58
357 查看
rhel服务器版本安装之后,默认创建的用户不能使用sudo。使用sudo,会提示 user1 is not in the sudoers file. This incident will be reported.
解决方法(比如创建的用户叫做user1, 密码user1pass):
1、直接运行visudo命令,或者vim /etc/sudoers 。 打开并编辑/etc/sudoers文件:
2、找到下边代码的位置,并删除第二行的 ‘#’
3、用root身份运行:
4、切换到user1用户,并查看是否已经属于wheel组:
如果显示为:
即表示成功。
5、测试:
显示类似下边代码即表明可以正常使用sudo:
完毕。
解决方法(比如创建的用户叫做user1, 密码user1pass):
1、直接运行visudo命令,或者vim /etc/sudoers 。 打开并编辑/etc/sudoers文件:
visudo 或者 vim /etc/sudoers
2、找到下边代码的位置,并删除第二行的 ‘#’
## Allows people in group wheel to run all commands # %wheel ALL=(ALL) ALL
3、用root身份运行:
usermod -aG wheel user1
4、切换到user1用户,并查看是否已经属于wheel组:
su - user1 groups
如果显示为:
user1 wheel
即表示成功。
5、测试:
sudo whoami
显示类似下边代码即表明可以正常使用sudo:
$ sudo whoami 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 USERNAME: root
完毕。
相关文章推荐
- 安卓端开源移动浏览器开源项目
- 学习进度条
- HDU 2154 跳舞毯 (递推)
- Spring Boot -- 启动彩蛋
- 随机生成小学四则运算题
- 复利计算1.0
- 复利计算
- springmvc请求不到页面
- uva10986 优先队列优化的Dijkstra
- rabbitmq
- .NET跨平台之旅:在Linux上以本地机器码(native)运行ASP.NET Core站点
- 课后实验2--四则运算2
- NYOJ90整数划分
- Java并发编程(二)
- Python __str__(self)和__unicode__(self)
- cocos2dx常见的46中+22中动作详解
- Docker 学习(1)
- Android之自定义侧滑菜单
- Laravel5 根目录router无效
- 对String的深入理解