After installed vim-gnome, every time I execute "sudo vim", it will print one line

$ sudo vim # doing something, and quit it
No protocol specified

This is caused by xauth.

Firstly, check the .Xauthority in your $HOME, if it does not exists, create it as follow:

$ cd ~
$ touch .Xauthority
$ xauth generate $DISPLAY . trusted

And then, you may required to make some change for your sodoers.

CAUTION: any change to sudoers should be very carefully. Please keep a root session before the follow command

echo 'Defaults env_keep += "DISPLAY XAUTHORITY"' | sudo tee /etc/sudoers.d/fix-no-protocol-specified-issue

Since you had changed something in /etc/sudoers.d/*, please check your sodoer is normal

sudo whoami

If it was damaged, please delete the file "/etc/sudoers.d/fix-no-protocol-specified-issue" in root, and let me know.

Finally, please check you vim. It could works fine.


Update:

Does not work when I restart my laptop. Add this file into my gnome-shell starting service list:

/usr/bin/touch $HOME/.Xauthority && /usr/bin/xauth generate $DISPLAY . trusted

References

Categories: Code

Yu

Ideals are like the stars: we never reach them, but like the mariners of the sea, we chart our course by them.

Leave a Reply

Your email address will not be published. Required fields are marked *