You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like a way to edit my sudoers file (or one of its includes) in a way that combines the best of sudoedit and visudo:
Runs the editor as myself, like sudoedit
Ensures I got the syntax right, like visudo
This might be doable today using something like sudo SUDO_EDITOR=my-wrapper visudo, where my-wrapper is a script that copies the given temp file over to a user-writeable one, runs sudoedit on that as SUDO_USER, and copies the modified file back over to original the temp file.
However, I think it would be much nicer if this functionality was available built-in.
In terms of the user interface, I would think it makes most sense to just enhance visudo to detect if it is being run by a user without write access to the given file(s) (i.e. typically a non-root user). If so, rather than invoking the editor directly, it would run sudoedit; perhaps after first checking via sudo -l that the required permissions exist (in order to give a better error message if not).
If this makes sense, I'd be happy to have a go at implementing this.
The text was updated successfully, but these errors were encountered:
I'd like a way to edit my
sudoers
file (or one of its includes) in a way that combines the best ofsudoedit
andvisudo
:sudoedit
visudo
This might be doable today using something like
sudo SUDO_EDITOR=my-wrapper visudo
, wheremy-wrapper
is a script that copies the given temp file over to a user-writeable one, runssudoedit
on that asSUDO_USER
, and copies the modified file back over to original the temp file.However, I think it would be much nicer if this functionality was available built-in.
In terms of the user interface, I would think it makes most sense to just enhance
visudo
to detect if it is being run by a user without write access to the given file(s) (i.e. typically a non-root user). If so, rather than invoking the editor directly, it would runsudoedit
; perhaps after first checking viasudo -l
that the required permissions exist (in order to give a better error message if not).If this makes sense, I'd be happy to have a go at implementing this.
The text was updated successfully, but these errors were encountered: