Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

visudo + sudoedit = ♥? #167

Open
c4rlo opened this issue Jul 31, 2022 · 0 comments
Open

visudo + sudoedit = ♥? #167

c4rlo opened this issue Jul 31, 2022 · 0 comments

Comments

@c4rlo
Copy link
Contributor

c4rlo commented Jul 31, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant