CentOS7系列--1.6CentOS7配置sudo
CentOS7配置sudo
如果一些用户共享权限,配置sudo是为了分离用户的职责
1. 将root 的权限传递给所有用户
[root@centos7 ~]# visudo
添加下面的内容到最后一行,使jack拥有root的所有权限
jack ALL=(ALL) ALL
[root@centos7 ~]# su - jack
Last login: Fri Oct 27 06:52:31 CST 2017 from 192.168.1.100 on pts/0
[jack@centos7 ~]$ /usr/bin/cat /etc/shadow
/usr/bin/cat: /etc/shadow: Permission denied
[jack@centos7 ~]$ sudo /usr/bin/cat /etc/shadow
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 jack:
root:$6$LpF2wUDowE.JSaw1$Gg8PQluOh2el9dFgzsgd/YwiCy9pw9.nAVvmV3lQwwj9gbZqySmsU2xxvvPId1mJ6mUSd04FPMhD.1jV5aKpp0::0:99999:7:::
bin:*:17110:0:99999:7:::
daemon:*:17110:0:99999:7:::
adm:*:17110:0:99999:7:::
lp:*:17110:0:99999:7:::
2. 配置一些命令不能通过sudo执行
[root@centos7 ~]# visudo
在Cmnd_Alias后一行添加
Cmnd_Alias USERMGR = /usr/sbin/useradd, /usr/sbin/userdel, /usr/sbin/usermod, /usr/bin/passwd'
在最后一行添加
%usermgr ALL=(ALL) USERMGR
[root@centos7 ~]# groupadd usermgr
[root@centos7 ~]# usermod -G usermgr jack
[jack@centos7 ~]# sudo /usr/sbin/useradd testuser
[jack@centos7 ~]# sudo /usr/bin/passwd testuser
Changing password for user testuser.
New password:
BAD PASSWORD: The password is shorter than 8 characters
Retype new password:
passwd: all authentication tokens updated successfully.
3. 传递root的部分权限到用户的sudo
[root@centos7 ~]# visudo
添加下面的内容到最后一行,使各用户拥有root的部分权限
jack ALL=(ALL) /usr/sbin/visudo
fedora ALL=(ALL) /usr/sbin/useradd, /usr/sbin/userdel, /usr/sbin/usermod, /usr/bin/passwd
ubuntu ALL=(ALL) /bin/vi
CentOS7系列--1.6CentOS7配置sudo的更多相关文章
- CentOS7系列--1.5CentOS7配置vim
CentOS7配置vim 1. 安装vim [root@centos7 ~]# yum -y install vim-enhanced Loaded plugins: fastestmirror ba ...
- centos7系列-给普通用户sudo权限
对于linux用户来讲,普通用户的权限是有一定限制的,所以在有些操作的时候,是需要sudo权限的,那么如何在linux下赋予普通用户sudo权限呢?此处将讲解一下方法. 在login我们的系统后,如果 ...
- CentOS7 系统服务器初始化配置、安全加固、内核升级优化常用软件安装的Shell脚本分享
转载自:https://www.bilibili.com/read/cv13875630?spm_id_from=333.999.0.0 描述: 适用于企业内部 CentOS7 系列操作服务器初始化. ...
- cobbler部署centos6与centos7系列
cobbler部署centos6与centos7系列 转载自:http://www.jianshu.com/p/a4bed77bf40d 版权声明:完全抄自 http://www.jianshu.co ...
- 转载:Centos7 从零编译配置Memcached
序言 Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度. Memca ...
- [原创]Centos7 从零编译配置Memcached
序言 Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态.数据库驱动网站的速度. Memca ...
- centos7+redis+php环境配置
centos7+redis+php环境配置 下载redis(更多版本可到redis官网进行查找) wget http://download.redis.io/releases/redis-3.0.7. ...
- CentOS7下Firewall防火墙配置用法详解
官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...
- Linux用户配置sudo权限
Linux用户配置sudo权限 创建sudo权限用户 #useradd supope #passwd supope #visudo #supope ALL=(ALL) AL ...
随机推荐
- 剑指offer四十之数组中只出现一次的数字
一.题目 一个整型数组里除了两个数字之外,其他的数字都出现了两次.请写程序找出这两个只出现一次的数字. 二.思路 建一个hashMap,统计各数字出现的次数,然后遍历hashMap,输出出现一次的数字 ...
- (转)十分钟了结MySQL information_schema
十分钟了结MySQL information_schema 原文:http://www.cnblogs.com/shengdimaya/p/6920677.html information_sche ...
- 常用chrome插件&&常用FireFox插件
第一部分:chrome插件 chrome中输入 chrome://chrome-urls/ 可以得到包括缓存在内的很多相关信息. 1.掘金chrome插件 点击下载 掘金是一个高质量的互联网技术 ...
- win7安装docker报错:error during connect: Get http ..... the system cannot find the file specified
因为是win7 所以使用了官方网站的dockertoolbox 安装一路顺利,结果启动就报上面的错误, 因为安装包附带安装了virtualbox 上面的错误后来排查出来是 virtualboox的问题 ...
- phpdocumentor生成代码注释文档(linux)
1,默认安装lnmp环境(php7),默认pear安装 2, pear channel-discover pear.phpdoc.org pear install phpdoc/phpDocume ...
- wordpress时间函数the_time() 详解
一直以来,我对时间显示这一块都没有给予些微的关注,但昨天无意间在网络上看到了上面有一篇文章所说的就是the_time()时间函数,感觉很有必要整理一下,便将其中的内容整理了下来.可能很多朋友对于时间的 ...
- Java 集合框架(二)—— ArrayList
二.数组列表 —— ArrayList 1.构造方法 ArrayList 是 Java 中的动态数组,底层实现就是对象数组,只不过数组的容量会根据情况来改变. 它有个带 int 类型参数的构造方法,根 ...
- ABP实战--项目结构
学习完毕With ASP.NET Core & Entity Framework Core Part-1及Part-2后,只实现了基本的功能,使用该工程继续学习ABP的更多功能. 更改项目结构 ...
- in运算符
//in运算符(用来判断一个属性是否在对象里面)var obj={"username":"hh"};console.log("username&quo ...
- 笔记:css3伪选择器改变滚动条样式
现在我打开支持前缀-webkit-的浏览器,也就是说只要支持前缀为-webkit-的浏览器才有效果 <!doctype html> <html lang="en" ...