Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connecting to a ubuntu 11.04 through ssh, and I'm trying to run this command(is a Image Magick command):

*This command saves any visible window on an X server and outputs it as an image file.

sudo import -window root -display :0 screen.png
No protocol specified import: unable to open X server `:0' @ error/import.c/ImportImageCommand/362.

I think that the problem is unity, because if I try this in ubuntu before 11.04 it runs without problems(The older versions uses gnome instead of unity). Somebody knows how to connect to the x server in ubuntu 11.04?

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

try running

xhost +localhost

On the server before grabbing the window.


BTW you need to be logged in as the same user whom has logged into the X server and set DISPLAY before running xhost.

share|improve this answer
No luck with this, doing exactly what you told me gives me this: No protocol specified xhost: unable to open display ":0" – xBoy Sep 15 '11 at 14:47
Then you're running sudo as the same user who is logged in - see also – symcbean Sep 15 '11 at 15:22

Your Answer


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.