[sudo-users] Adding support to sudo to open a file with elevated privileges

Piotr Dobrogost 2021 at p.dobrogost.net
Sun Sep 5 09:26:06 MDT 2021


On Sun, Sep 5, 2021 at 3:15 PM Ed Neville <ed-sudo at s5h.net> wrote:
>
> That's something that I think it has already. You can use sudoedit to
> write the file, but you need to set the EDITOR as tee or cat:
>
>   <https://www.usenix.org.uk/content/sudo.html#safe-file-edits>
>
> echo "something" | EDITOR=/bin/tee sudoedit /etc/config_file >/dev/null

Interesting.
However I fail to see how it is better than simpler

echo "something" | sudo /bin/tee /etc/config_file >/dev/null

already mentioned as a suggested way of handling this?

What you proposed still uses external binary (tee), still requires
redirection of standard output and in addition uses additional
features of sudo not required when using simpler form.


Regards,
Piotr Dobrogost


More information about the sudo-users mailing list