我有一个修改AWS实例的ansible脚本。它向它们添加一个用户,然后向/etc/sudoers添加行,以便新用户可以执行特定的命令。我对命令使用Cmnd_Alias,所以/etc/sudoers如下所示:
Cmnd_Alias BMCCMDS = /bin/cat, /usr/sbin/lsof, /usr/bin/test, /Sorry, user bmcdisc is not allowed to ex
在sudo模式下运行任何命令时,我都会遇到错误。sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set但这些都解决不了我的问题。可能我的案子和他们不一样。我试着在utorrent的顶部投票答案之后安装这个问题。
我希望得到一个不建议我重新安装系统的答案。
如果重新安装是唯一的解决方案,我将不得不备份我曾经安装的一切。
Linux可以根据条件判断在Linux中的某一行插入内容吗?例如,我想将用户"test“添加到/etc/sudoers,让它可以切换到root: 2 # This file MUST be edited with the 'visudo' commandas root. 4 # Please consider adding local content in /etc/sudoers.d/ instead of