How to open a remote python program from terminal by ssh?

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?


Solution 1:

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.

Solution 2:

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.