Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question
1  
Not everything is working normally. Mouse support isn't working, it needs a protocol such as gpm or the xterm mouse protocol. –  ninjalj Feb 26 '11 at 17:52

2 Answers 2

up vote 5 down vote accepted

A recent upgrade changed default settings for sudo. If anyone have this problem check your sudoer configuration. From an example in the man page:

# Run X applications through sudo; HOME is used to find the
# .Xauthority file.  Note that other programs use HOME to find
# configuration files and this may lead to privilege escalation!
Defaults env_keep += "DISPLAY HOME"

Make sure you have something like that in /etc/sudoers (use visudo to edit the file if you need to).

share|improve this answer

According to this thread, there are two possible solutions to your problem:

Put the following line in my root users .bashrc script

export XAUTHORITY=/home/<user>/.Xauthority

then I copied .Xauthority to root also, i.e.

sudo cp ~/.Xauthority /root

and now the warning is gone.

You could also try running via gksudo.

Anyway, both are worth a try...

share|improve this answer
    
I copied .Xauthority to /root and that's it! –  phunehehe Feb 27 '11 at 4:27
    
No I was wrong, after rebooting I got "invalid key" error. –  phunehehe Feb 28 '11 at 9:07
1  
As far as I remember the contents of a .Xauthority file changes, so you should symlink it instead of copying. –  Adam Byrtek Mar 31 '11 at 21:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.