I type ssh -X [email protected]
and asks for a password, I type it in and get logged in.
[email protected]:~$ program.py
then nothing happens, when it should actually pop up. Why is this happening and how do I solve it?
I type ssh -X [email protected]
and asks for a password, I type it in and get logged in.
[email protected]:~$ program.py
then nothing happens, when it should actually pop up. Why is this happening and how do I solve it?
The problem is that the SSH connection is not forwarding X11 commands over the connection.
If the machine you are using to connect is running Linux (or another OS with X) then simply pass the -X
param when invoking SSH.
If you are connecting with Microsoft Windows, you will need a program that can translate X11 commands into Windows API commands. Try looking at XMing or cygwin.
Ctrl+C
?
Dec 18, 2010 at 20:08
You may also need to add/uncomment the following line from your /etc/ssh/sshd_config
:
X11Forwarding yes
The -X flag is useless without this.
You probably need to enable X forwarding in your SSH server's configuration file, /etc/ssh/sshd_config
:
X11Forwarding yes
If you don't have access to this file, I'm afraid you will have to ask your sysadmin to enable it.
It sounds like your DISPLAY variable is getting set somewhere. When I SSH into my machine from my phone (with X forwarding) and run the following:
oli@bert:~$ echo $DISPLAY
localhost:10.0
Though it's not a guarantee, X forwarding tends to use high display numbers.
If your ~/.bashrc
is set to override the display, you'll likely see something more like like :0
.
You can either guess and over-override the DISPLAY
variable to localhost:10.0
after you connect:
export DISPLAY=localhost:10.0
Of find where you're setting display in your local bash files.
I should add that it's possible to turn off X forwarding in the SSHd settings (/etc/ssh/sshd_config
) so you might want to check that too.
echo $DISPLAY
when connected via SSH? What did you see?
It is just as you do in your PC,
ssh -X remotehost python remotepythonprogram.py
To view the program code,
ssh -X remotehost less remotepythonprogram.py
-X
flag in the connection string, I think we're talking about a graphical X-forwarded application, not a text-mode app.
Oliver's solution is the way to go if you want to forward X, but understand that this may be bandwidth-intensive.
An alternate solution is to use a command line editor like vim
or nano
. Personally, I would go with vim
. It does have a steeper learning curve, but once you get past that, you will not want to go back to anything else =) You can start learning it by executing vimtutor
for a tutorial on the basics.
echo $DISPLAY
print when you run it in your ssh session?