Duncaen / OpenDoas

A portable fork of the OpenBSD `doas` command
Other
623 stars 35 forks source link

OpenDoas keepenv on macOS #44

Closed grylem closed 3 years ago

grylem commented 3 years ago

Hi doas.conf contains the line -' permit keepenv grylem as root' But vim does not recognize .vimrc etc in grylem $HOME if run 'doas vim file' Regards.

Duncaen commented 3 years ago

The big reason to not do this is that you would backdoor yourself by allowing to blindly execute your vimrc, or your shells profile when running commands as root with doas.

You need to use setenv if you really want to keep those environment variables i.e. setenv { HOME USER }, keepenv is for anything that is not already explicitly set: https://github.com/Duncaen/OpenDoas/blob/31abd37c26c26892ce5e0d538c51fbc38ff3e05a/env.c#L106-L111