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

Tim Bradshaw tfb at tfeb.org
Sun Sep 5 14:21:31 MDT 2021



> 
> On 4 Sep 2021, at 12:51, Piotr Dobrogost <2021 at p.dobrogost.net> wrote:
> 
> Something along the lines of
> echo "something" | sudo --out /etc/config_file

You'd certainly need a whole additional rule syntax for something like that: which files is sudo allowed to write to; does it append, overwrite or both (both should certainly be options); what happens when the write fails (the original file must be left untouched at all costs) and so on.  Of course tee / cat are unlikely to do that either: almost certainly the answer is a tool which does, which can then just be used in ordinary sudo rules: 'echo ... | sudo fwrite -a /etc/config_file'

--tim


More information about the sudo-users mailing list