Recently I start to get "No protocol specified" when using sudo vim
. It's just a warning I guess, because everything was working normally (I can open, edit and save files). The message doesn't appear if I use sudo -E vim
so I think I did something wrong when editing /etc/profile
recently, but I'm not sure. How can I fix this?
“No protocol specified” when running vim with sudo
environment-variablessudovim
Best Answer
A recent upgrade changed default settings for
sudo
. If anyone have this problem check yoursudoer
configuration. From an example in the man page:Make sure you have something like that in
/etc/sudoers
(usevisudo
to edit the file if you need to).EDIT: I don't know exactly since when, but at least xauth 1.0.9 supports the environment variable
XAUTHORITY
. Setting that and leaving HOME untouched, also fixes the protocol warning and is the better solution, as no world-writeable IPC resources (sockets/pipes) are created pointing to root resources (one avenue for privilege escalation). xauth doesn't automatically export the variable to the environment, so the best way is to set it in your shell's initialization.