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.

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 ssh ( with -X option ) to another computer then I I do a chroot.

I then encounter problems running X11 apps.

As one example, after the ssh I would run emacs and it would open a new window as a X11 app. After running the chroot and doing ssh I would see emacs running as a console app.

I don't get errors since emacs can be run it as an X11 app or a console app, but with other GUI apps I get the error message:

"cannot open display: localhost:10.0"

PS: Just to head off anyone who wants to suggest checking $DISPLAY, that is set correctly.

I was wondering if there are any logs to check to see if I can identify the problem.

share|improve this question

Take a look at this thread on Super User titled: How do I fix a “cannot open display” error when opening an X program after ssh'ing with X11 forwarding enabled?

Given you're able to ssh using the first account you're ssh'ing in with your issue isn't with this:

# /etc/ssh/sshd_config
X11Forwarding yes

It's likely that now that you've chroot'ed you no longer have access to your .XAuthority file on your local side. This file is required in order to manage the remote displaying of X applications.

See the xauth and mkxauth man pages for more details.

Also if you're unfamiliar with how X's $HOME/.Xauthority and the MIT-MAGIC-COOKIE's mechanisms work there is a good primer here titled: Lack of .Xauthority, on how it works.

share|improve this answer
Unfortunately it seems the mkxauth program isn't available for Debian. – Mouse.The.Lucky.Dog May 2 '13 at 22:21
I don't think it's the .Xauthority. Listing the cookies in the initial environment and the chroot environment shows the same cookies. – Mouse.The.Lucky.Dog May 2 '13 at 22:39
How about if you move the existing .Xauthority file out of the way and create a new one? Also this chrooted environment has a full complement of X tools? Curious how it's able to call the various tools to manipulate the .Xauthority file in that env. – slm May 2 '13 at 23:03
Also can you please explain your chroot command a little bit more? I'm having a hard time understanding what your environment looks like after you run it. Do you have access to all the same tools you had access to prior in this chroot environment? xauth? ls? etc. – slm May 2 '13 at 23:55

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.