[英]How to specify the rpm packages that a user can install using visudo?
I need to specify the prefix of the rpms that a specific user can install on a CentOS 7 server. 我需要指定特定用户可以在CentOS 7服务器上安装的rpm的前缀。 For example, let's say that I have:
例如,假设我有:
I thought that I could add this: 我以为可以添加以下内容:
my_user ALL=NOPASSWD: /bin/rpm* my_package*
But it's not working. 但这不起作用。
I also tried variations, like: 我还尝试了变体,例如:
my_user ALL=NOPASSWD: /bin/rpm my_package*
Finally I tried like below, but this allows me to install any rpm, what I don't want. 最后,我尝试如下进行操作,但这使我可以安装任何不需要的rpm。
my_user ALL=NOPASSWD: /bin/rpm
I could figure out the problem. 我可以找出问题所在。
I was trying to install my package using -ivh, but this was not correct in my sudoers file. 我试图使用-ivh安装软件包,但这在我的sudoers文件中不正确。 So I adjusted like this and worked:
所以我像这样调整并工作:
my_user ALL=NOPASSWD: /bin/rpm -* my_package*
Now I can install using: 现在,我可以使用以下命令进行安装:
sudo rpm -ivh my_package_boo.rpm
sudo rpm -e my_package_boo
(...)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.