当前位置:网站首页>sudo 权限控制,简易
sudo 权限控制,简易
2022-08-04 01:54:00 【qq_38781075】
修改sudo权限的文件在下面这里,记得给予写权限
chmod +w /etc/sudoers
vim /etc/sudoers我设置了一组命令叫做 USERCMD (名字随便起),只能用sudo执行cp命令,不能用sudo执行kill命令,并且免密使用sudo (下面示例是test用户),加 ! 表示不能执行哪些命令,见下面框框里
其实只要你不写 /usr/bin/ 这样的命令给用户使用(因为代表 /usr/bin/ 下所有命令),不加 ! 也没事,另外,sudoers 是从后往前进行检测的(后面的优先级判定高),也就是 ! 这种命令要放后面
还有就是支持正则 比如 : /usr/bin/cp ~/* /home ,这样的命令,但是不能写 " ,只能斜杠转义空格,见
linux - How to let the user execute a command containing quotes in sudoers? - Server Fault
Cmnd_Alias 相当于是设置命令组,可以设置多个,用的时候可以用逗号分隔
Cmnd_Alias USERCMD=/usr/bin/cp,!/usr/bin/kill
# Cmnd_Alias TESTCMD=/usr/bin/cp,!/usr/bin/kill
test ALL=(ALL) NOPASSWD: USERCMD
# test ALL=(ALL) NOPASSWD: USERCMD,TESTCMD如果想直接给予root同等权限,建议
test ALL=(ALL) NOPASSWD: ALL详细还是参考
边栏推荐
- C语言:学生管理系统(链表版)
- 哎,又跟HR在小群吵了一架!
- Flask Framework Beginner-05-Command Management Manager and Database Use
- thinkphp 常用技巧
- flask框架初学-06-对数据库的增删改查
- 螺旋矩阵_数组 | leecode刷题笔记
- 持续投入商品研发,叮咚买菜赢在了供应链投入上
- C program compilation and predefined detailed explanation
- Deng Qinglin, Alibaba Cloud Technical Expert: Best Practices for Disaster Recovery across Availability Zones and Multiple Lives in Different Locations on the Cloud
- Web APIs BOM - operating browser: swiper plug-in
猜你喜欢

Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment

计算首屏时间

Example 041: Methods and variables of a class

持续投入商品研发,叮咚买菜赢在了供应链投入上

Presto中broadcast join和partition join执行计划的处理过程

实例037:排序

C程序编译和预定义详解

Priority_queue element as a pointer, the overloaded operators

企业虚拟偶像产生了实质性的价值效益

TensoFlow学习记录(二):基础操作
随机推荐
C程序编译和预定义详解
Continuing to invest in product research and development, Dingdong Maicai wins in supply chain investment
Installation and configuration of nodejs+npm
KunlunBase 1.0 is released!
GNSS[0]- Topic
Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
Variable string
如何通过API接口从淘宝(或天猫店)复制宝贝到拼多多接口代码对接教程
贪吃蛇游戏Bug解析及功能扩展
Kubernetes:(九)coredns(浪不动了)
持续投入商品研发,叮咚买菜赢在了供应链投入上
5.scrapy中间件&分布式爬虫
priority_queue元素为指针时,重载运算符失效
实例041:类的方法与变量
第13章 网络安全漏洞防护技术原理与应用
appium软件自动化测试框架
boot issue
KunlunBase 1.0 发布了!
Web APIs BOM- 操作浏览器:swiper 插件