Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenSSH: Users

Getting rid of "Cannot open display" message

 

 

OpenSSH users RSS feed   Index | Next | Previous | View Threaded


amitds at oversi

May 4, 2009, 10:56 PM

Post #1 of 6 (1788 views)
Permalink
Getting rid of "Cannot open display" message

Hi all.

I'm using ssh to execute a command on a server. When the remote server
has an X server running, I get a/m message written to standard error.

amit0 ~ # ssh localhost echo bla
Cannot open display "default display"
Cannot open display "default display"
bla

Appending the '-x' parameter, as suggested, doesn't seem to help:

amit0 ~ # ssh -x localhost echo bla
Cannot open display "default display"
Cannot open display "default display"
bla


I want to disable whatever's causing this message. I don't need X
running over the connection.

How do I get rid of this message?

ssh version:
amit0 ~ # ssh -V
OpenSSH_5.2p1, OpenSSL 0.9.8k 25 Mar 2009

10x,
Amit


robert.weeden.jr at ge

May 5, 2009, 9:14 AM

Post #2 of 6 (1711 views)
Permalink
RE: Getting rid of "Cannot open display" message [In reply to]

"-X" capitalize it.

-----Original Message-----
From: listbounce [at] securityfocus [mailto:listbounce [at] securityfocus]
On Behalf Of Amit Dor-Shifer
Sent: Tuesday, May 05, 2009 1:56 AM
To: secureshell [at] securityfocus
Subject: Getting rid of "Cannot open display" message

Hi all.

I'm using ssh to execute a command on a server. When the remote server
has an X server running, I get a/m message written to standard error.

amit0 ~ # ssh localhost echo bla
Cannot open display "default display"
Cannot open display "default display"
bla

Appending the '-x' parameter, as suggested, doesn't seem to help:

amit0 ~ # ssh -x localhost echo bla
Cannot open display "default display"
Cannot open display "default display"
bla


I want to disable whatever's causing this message. I don't need X
running over the connection.

How do I get rid of this message?

ssh version:
amit0 ~ # ssh -V
OpenSSH_5.2p1, OpenSSL 0.9.8k 25 Mar 2009

10x,
Amit


robert.lanning at gmail

May 5, 2009, 9:41 AM

Post #3 of 6 (1699 views)
Permalink
Re: Getting rid of "Cannot open display" message [In reply to]

look into your ~/.profile and /etc/profile.
You might be running an X client.

On Mon, May 4, 2009 at 10:56 PM, Amit Dor-Shifer <amitds [at] oversi> wrote:
> Hi all.
>
> I'm using ssh to execute a command on a server. When the remote server
> has an X server running, I get a/m message written to standard error.
>
> amit0 ~ # ssh localhost echo bla
> Cannot open display "default display"
> Cannot open display "default display"
> bla
>
> Appending the '-x' parameter, as suggested, doesn't seem to help:
>
> amit0 ~ # ssh -x localhost echo bla
> Cannot open display "default display"
> Cannot open display "default display"
> bla
>
>
> I want to disable whatever's causing this message. I don't need X
> running over the connection.
>
> How do I get rid of this message?
>
> ssh version:
> amit0 ~ # ssh -V
> OpenSSH_5.2p1, OpenSSL 0.9.8k 25 Mar 2009
>
> 10x,
> Amit
>
>



--
And, did Galoka think the Ulus were too ugly to save?
-Centauri


dnelson at allantgroup

May 5, 2009, 10:25 AM

Post #4 of 6 (1697 views)
Permalink
Re: Getting rid of "Cannot open display" message [In reply to]

In the last episode (May 05), Amit Dor-Shifer said:
> Hi all.
>
> I'm using ssh to execute a command on a server. When the remote server
> has an X server running, I get a/m message written to standard error.
>
> amit0 ~ # ssh localhost echo bla
> Cannot open display "default display"
> Cannot open display "default display"
> bla
>
> Appending the '-x' parameter, as suggested, doesn't seem to help:
>
> amit0 ~ # ssh -x localhost echo bla
> Cannot open display "default display"
> Cannot open display "default display"
> bla

You must have something in one of your shell's startup scripts that is
trying to access an X display. Adding a "set -x" at the top of your scripts
will force each line to be printed as it is run, which should help you track
down the offending commands.

--
Dan Nelson
dnelson [at] allantgroup


amitds at oversi

May 6, 2009, 11:10 PM

Post #5 of 6 (1681 views)
Permalink
Re: Getting rid of "Cannot open display" message [SOLVED] [In reply to]

Thanks Dan!
The offender was a call to setxkbmap in ~/.bashrc. Two calls, in-fact,
hence the two error messages.

As I now realize, disabling X11 forwarding on either client or server
side wouldn't have helped me a bit, right? If any, it would insure that
I'd get the message, because the message is generated by the X-program,
which gets called anyways, and disabling X-forwarding would just make
the X program more angry.

I caught the program fairly quickly. For those with more complicated
setups, I'd suggest the following diagnostic process for identifying the
cause of the problem:

a) invoke sshd from the cmdline, wrapped by strace, tracing exec() and
write() calls:
strace -f -e trace=process,write -o /tmp/sshd.strace /usr/sbin/sshd
b) Reporduce:
amit0 ~ # ssh localhost echo bla
Cannot open display "default display"
bla
c) Look for the PID that's writing the error message:
29350 write(2, "Cannot open display \"default dis"..., 38) = 38
d) Now locate the exec() call relating to that PID:
29350 execve("/usr/bin/setxkbmap", ["setxkbmap"...,

Amit



Dan Nelson wrote:
> In the last episode (May 05), Amit Dor-Shifer said:
>
>> Hi all.
>>
>> I'm using ssh to execute a command on a server. When the remote server
>> has an X server running, I get a/m message written to standard error.
>>
>> amit0 ~ # ssh localhost echo bla
>> Cannot open display "default display"
>> Cannot open display "default display"
>> bla
>>
>> Appending the '-x' parameter, as suggested, doesn't seem to help:
>>
>> amit0 ~ # ssh -x localhost echo bla
>> Cannot open display "default display"
>> Cannot open display "default display"
>> bla
>>
>
> You must have something in one of your shell's startup scripts that is
> trying to access an X display. Adding a "set -x" at the top of your scripts
> will force each line to be printed as it is run, which should help you track
> down the offending commands.
>
>


4ux6as402 at sneakemail

May 8, 2009, 3:42 AM

Post #6 of 6 (1676 views)
Permalink
Re: Getting rid of "Cannot open display" message [SOLVED] [In reply to]

Hi,

Amit Dor-Shifer amitds-at-oversi.com |Lists| wrote:
> I caught the program fairly quickly. For those with more complicated
> setups, I'd suggest the following diagnostic process for identifying the
> cause of the problem:

Or for faster results, try with temporary empty ~/.profile and
~/.bashrc. If that doesn't fail you'll know they are the culprit, then
try deleting lines in your original ~/.profile and ~/.bashrc using
bisection.

And to call the X clients safely once you've identified them:

if [ "$DISPLAY" != "" ] ; then
# Call X clients
setxkbmap yada yada yada
xfoo --bar
fi

Beware, that if you're over a slow SSH connection, it could take time
for the clients to contact your DISPLAY even if it does work.

Especially, to start vi without it taking forever:
vi -X file.ext

Peter
--
Peter Valdemar Mørch
http://www.morch.com

OpenSSH users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.