Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I type ssh -X name@blah.edu and asks for a password, I type it in and get logged in.

name@blah.edu:~$  program.py

then nothing happens, when it should actually pop up. Why is this happening and how do I solve it?

share|improve this question
    
@shi what does echo $DISPLAY print when you run it in your ssh session? –  karthick87 Dec 18 '10 at 20:04
    
It displays localhost:14.0 –  shi Dec 18 '10 at 20:26
    
I added the information from your duplicate question which should be closed. –  andrewsomething Dec 19 '10 at 20:45
add comment

6 Answers

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
    
nothing pops up, I try to open other programs from the remote computer that are not python, they don't open either. –  shi Dec 18 '10 at 17:47
1  
@karthick87 given the -X flag in the connection string, I think we're talking about a graphical X-forwarded application, not a text-mode app. –  Oli Dec 18 '10 at 18:30
    
yes something like fityk –  shi Dec 18 '10 at 18:56
    
why doesnt it pop up? –  shi Dec 18 '10 at 19:03
    
In addition, when I open a program from my local account using terminal, it works. FOr example, I type "firefox"...firefox pops up. Then whe I ssh into my remote account, I type "firefox" nothing happens. What is the problem? –  shi Dec 18 '10 at 19:29
show 1 more comment

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.

share|improve this answer
    
I typed ssh -X name@blahblahblah.edu got prompted for and typed in password,,, got logged in, then typed "firefox" and nothing happened. Im using ubuntu. –  shi Dec 18 '10 at 19:44
    
Are there any errors reported? –  Nathan Osman Dec 18 '10 at 19:45
    
no, just nothing pops up –  shi Dec 18 '10 at 19:49
    
@shi: Does the command terminate, or do you have to hit Ctrl+C? –  Nathan Osman Dec 18 '10 at 20:08
    
I don't have to do anything, the terminal appears as normal, just like when I open a program locally, but when I'm in my remote account, the only difference is that the program doesn't pop up. –  shi Dec 18 '10 at 20:16
show 8 more comments

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.

share|improve this answer
    
My computer is originally a windows vista,then I used wubi to install ubuntu 10.04.1 . Normally at work when I type in the commands the program opens and pops up in a new window, now on my laptop ubuntu, I type in the exact same thing and nothing pops up. –  shi Dec 18 '10 at 19:20
    
@shi did you run echo $DISPLAY when connected via SSH? What did you see? –  Oli Dec 19 '10 at 0:03
add comment

Your Answer

 
discard

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