【发布时间】:2012-05-12 08:07:24
【问题描述】:
我想删除 /etc/sudoers 文件中的 (uncommnet #) 轮组,那么我应该使用什么正则表达式模式?
#cat /etc/sudoers
....
....
## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS
## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL
## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
....
....
我想从下一行删除#。
...
# %wheel ALL=(ALL) NOPASSWD: ALL
...
【问题讨论】:
-
您可以在此线程中查看 Alex G 的答案:stackoverflow.com/questions/38849067/…。他设法使用
sed编辑文件,然后在保存更改之前使用visudo检查格式。