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 have recently switched from windows 7 to ubuntu 12.10. In ubuntu 12.10 I am using putty to connect to a unix machine remotely where several of my files are stored but editing texts files through the command prompt is tedious in my opinion. How can I configure putty to allow me to run xterms and in turn run software such as emacs (which is installed on the unix machine) to edit files on the unix machine from my ubuntu machine?

In windows an x server is needed such as xMing, is any additional software necessary?

share|improve this question

3 Answers 3

Do you really use Putty to connect from an Ubuntu machine to an Ubuntu server? This is a highly unusual choice, I wasn't even aware Putty runs on Linux (turns out it actually does and even is in Ubuntu repositories).

A more conventional approach is to use ssh command from openssh-client package, which is a native implementation of a client for OpenSSH protocol. Install it with

sudo apt-get install openssh-client

Then you can connect to a remote machine with

ssh [email protected]

If you enable X11 forwarding with the -X switch, you'll be able to run applications on the remote machines and have them displayed on your local machine:

ssh -X [email protected]

Since you are running an proper real X server, you don't need to run xMing or anything like that.

Although, I agree that this is a solution for a strange problem - if you want to just edit text files, much more efficient options would be:

  • find a text-mode editor which suits you. I personally prefer Midnight Commander's editor which you can run with mc -e myfile.txt.

  • somehow mount the remote directory and edit files in your local text editor (using sshfs)

  • in KDE you can directly open a file from a remote host in any program using fish:user@host/path/to/file.txt. I think Gnome also can do something similar

  • make a local copy of the files, edit local files and use rsync to upload the changes

  • use a version control system

share|improve this answer

The server you are connecting to must also have the X libraries installed on it, as they will be a dependency for any graphical text editors and xterms you want to run. If it does, then you can connect to it from your Ubuntu box with the commandline:

ssh -X username@remotehost 

Then you can simply run the command you want. To start a graphical emacs session:

xemacs filename
share|improve this answer

You are correct that you will need to be running an X server like xMing locally.

The Putty connection settings allow you to turn on X forwarding when you connect. If you enable that and have a local X server running, then running graphical programs through the SSH connection should just work. See http://www.math.umn.edu/systems_guide/putty_xwin32.html

Know ahead of time that it's going to be slow. It can help to turn on compression in your connection settings too. I understand it can be tedious to edit text files remotely before you know a good text editor well - I highly recommend learning vi/vim if you plan on editing files on remote linux servers regularly.

If you definitely want a graphical environment, VNC is another option. You can install and run vncserver on the server and connect to it using a VNC client. While VNC still has a noticeable lag, it can be significantly better than forwarding X over an internet connection. VNC is optimized for use over a network, whereas X is not. If your server's firewall does not allow you to connect to the VNC port (ie. 5901), then you can use putty to set up a reverse SSH tunnel that forwards the VNC port to a port on your local windows machine that you can connect to. See https://intranet.cs.hku.hk/csintranet/contents/technical/howto/putty-portforward.jsp

share|improve this answer
Is it possible to use VNC to connect to a machine which does not run an X server? I think the OP wants to connect to a headless machine somewhere on Internet –  Sergey Jan 16 '13 at 2:47
It is possible to run VNC on a server that doesn't already have X running, but running VNC /is/ running a separate X server and has all the overhead associated with that, except that you can bring it up and kill it when you're done to free the resources. Since with X forwarding you're not running a window manager, there's relatively no resource overhead overhead compared with running X or VNC. –  nilbus Jan 16 '13 at 2:53
If you have a desktop visible, you are already running an X server. –  tripleee Jan 16 '13 at 4:42
For headless computer with X installed but no session launch , i'd rather use X2Go, is a "equivalent" to TSE in windows, i found it a lot more usable than VNC –  eephyne Jan 16 '13 at 6:22

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.