I want to remove (uncommnet #) wheel group in /etc/sudoers file so what would be the Regex pattern i should use?
#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
....
....
I want to remove # from following line.
...
# %wheel ALL=(ALL) NOPASSWD: ALL
...
You shouldn’t edit the
/etc/sudoersfile with any sort of script. There’s a reason for thevisudocommand. Edits to thesudoersfile should be rare and well-controlled.That being said, if your editor for the
visudocommand is vi, you can run something like:%s/^# %wheel/%wheel/to uncomment all of the lines what start with%wheel.Or, if you reeeeeeally think it’s necessary:
Run it without the
--in-placefirst to check the output. Use it at your own risk.