Thursday, March 01, 2018

Re: sudoedit for doas?

Le 2018-03-01 11:41, tomr a écrit :
> On 02/28/18 17:50, Hess THR wrote:
>> Hello,
>>
>> hmm, I went through the relevant man pages:
>>
>> https://man.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man1/doas.1
>> https://man.openbsd.org/doas.conf.5
>>
>> but I cannot find a sudoedit alternative for the "doas".
>>
>> Are there any?
>
> Use `doas -C` in a wrapper script that:
>
> - checks for a lock / creates a lock
> - copies /etc/doas.conf somewhere
> - edits it with your editor of choice
> - checks it (with -C)
> - copies it back into place
> - removes the lock
>
> t

Hello,

What you said mimics visudo (to edit sudo configuration file), not
sudoedit which is documented in sudo(8) :

1.Temporary copies are made of the files to be edited with the owner
set to the invoking user.
2.The editor specified by the policy is run to edit the temporary
files. The sudoers policy uses the SUDO_EDITOR, VISUAL and EDITOR
environment variables (in that order). If none of SUDO_EDITOR,
VISUAL or EDITOR are set, the first program listed in the editor
sudoers(5) option is used.
3.If they have been modified, the temporary files are copied back to
their original location and the temporary versions are removed.

No comments:

Post a Comment