How to use gedit from putty remote connection on Putty

14,839

There are two different ways of achieving this:

  • executing a remote gedit using X Forwarding via SSH
  • executing a local gedit on a remote file through SSH

Remote gedit

Normally you do that using X Forwarding via SSH. On Windows you will need some kind of X server, for example xming. See http://www.math.umn.edu/systems_guide/putty_xwin32.html for instructions.

There are more tutorials on the web, from brief Googling:

Local gedit

You point your local gedit installed on your machine to the remote file through SSH. See e.g. http://thecodecentral.com/2010/04/02/use-gedit-as-remote-file-editor-via-ftp-and-ssh-ubuntu how to do that on Ubuntu.

On Windows, you might want to mount a remote folder as a local disk: How do I mount a remote Linux folder in Windows through SSH?

Alternatively, it might be possible to use a Gedit plugin: https://code.google.com/p/gedit-remote-editing-file/

Share:
14,839
Ryman Holmes
Author by

Ryman Holmes

Programmer from the University of Toronto, Canada. Web Applications | Mobile Web Design | Web Development

Updated on June 05, 2022

Comments

  • Ryman Holmes
    Ryman Holmes almost 2 years

    I am struggling to use gedit through a remote connection using Putty from a windows machine, it will really help if someone can find a way to do this.

    Is there a way we can use gedit from a windows machine by using putty to remotely connect?

  • Ryman Holmes
    Ryman Holmes about 10 years
    I followed the instructions of the link you sent, I downloaded and installed X server and configured it however it doesn't still recognise commands like xeyes & or gedit
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    What do you mean it does not recognize? Are you getting some errors? It should work if xeyes and gedit are installed, which I suppose they are (you can check by running which xeyes). Sometimes there is a problem with authorization. You might need to run e.g. xhost + on the server where you are trying to run gedit. But notice that xhost + grants access to everyone. You might want to restrict it.
  • Ryman Holmes
    Ryman Holmes about 10 years
    I have gedit downloaded but when I try to open say an sh script file using the command gedit file.sh it gives me the error gedit: command not found
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    Then gedit is not installed or it is not on your PATH. Install gedit properly first. What OS is it? On Debian and Ubuntu you would do sudo apt-get install gedit. One problem could be that PATH is not initialised because logging in via putty doesn't source .bashrc. Check your 'PATH' and try to source .bashrc by running '. .bashrc'.
  • Ryman Holmes
    Ryman Holmes about 10 years
    I have installed gedit however I don't know how to set the PATH... I'm on Windows 7... Putty is not recognising any of the commands you are telling me#
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    How exactly did you install gedit? You are on windows 7 but what is the OS of the server where you are logging in? After you log in, run uname -a and echo $PATH and post the outputs here.
  • Ryman Holmes
    Ryman Holmes about 10 years
    I installed gedit the standard way using windows installer. Not sure what you mean by what is the OS server, I am using xming as the instructions told me to. I am logging on to my University server remotely which is Windows 7. When I run uname -a I get this: SunOS gnasher 5.9 Generic_122300-19 sun4u sparc SUNW,UltraAX-i2 When I run echo $PATH i get this: /usr/bin:/usr/local/bin
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    The server is running Solaris 9, not a linux. You might want to check whether there is X11 installed (java.net/projects/solaris-x11/pages/Home). Check what shell you are running echo $SHELL, if it is not bash, try running bash bash and look what scripts are available in the home directory after you login ls -a and look for .bashrc or .bash_profile, have a look whether they set up PATH or just try to source them source .bashrc, and/or source .bash_profile.
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    I am confused :) Are you saying the remote system is Windows 7 but you can run uname -a and it says SunOS 5.9? That doesn't make any sense. You're using Windows 7 on your own computer and you are logging onto a remote university server which runs Solaris 9 (SunOS 5.9). You have to install gedit on the remote university system running Solaris 9 if you want to use it on that system.
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    What happens is: gedit is executed on the remote machine and X11 forwarding takes care of sending the rendered image of gedit to your local xming which renders it for you and allows you to interact with it. It is doable but usually it is a bit slow. IMHO you'd be better off just using a text based editor on the remote machine (like Vi or Emacs or Nano if you want something simple to use).
  • Ryman Holmes
    Ryman Holmes about 10 years
    Sorry... My mistake I am new to all this.. The university server runs Solaris 9. Gedit is already installed on the University machines however gedit only works if you login to Linux (Ubuntu) on the University machines as when you startup you have an opton of logging on to Linux or Windows... All I want is to open gedit from my home computer once I remotely connect, why is it so difficult
  • Ryman Holmes
    Ryman Holmes about 10 years
    It is Bash that is running by the way (on the University machines)
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    In that case it will be probably easier for you (and much nicer to use) to setup something like this: thecodecentral.com/2010/04/02/… Essentially you point your local gedit installed on your Windows to the remote file through SSH. But you have to configure it properly on Windows (the link is for ubuntu).
  • Jakub Kotowski
    Jakub Kotowski about 10 years
  • Ryman Holmes
    Ryman Holmes about 10 years
    You've lost me... I want to use putty to open gedit not install other programs.
  • Ryman Holmes
    Ryman Holmes about 10 years
    I don't understand what the problem is with me opening gedit remotely, I have installed it and everything as the instructions told me to
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    Well, I misunderstood you originally. There are two ways your original question can be interpreted: 1. How do I run gedit on a remote machine ? 2. How do I use local gedit to edit a remote file through SSH? I thought you're asking the first question and didn't think about it twice, sorry. It turns out you are in fact asking the second question. Solutions to both would achieve what you are ultimately after. Originally I suggested solutions to the first question. Scratch that. You can try the other approach. I hope it's clearer.
  • Ryman Holmes
    Ryman Holmes about 10 years
    yes... I want to use local gedit to edit a remote file through SSH, Which approach should I try?
  • Jakub Kotowski
    Jakub Kotowski about 10 years
    The second one: you attach a remote filesystem as a local windows disk through SSH. This or something similar is what you need to achieve. I'm saying something similar because sometimes the apps support opening URLs such as ssh://user@host:myRemoteFile.txt in which case you wouldn't need to attach a disk but just to enter such URL. I don't think Gedit supports such URLs directly, but there might be plugins for that: code.google.com/p/gedit-remote-editing-file
  • Jakub Kotowski
    Jakub Kotowski about 10 years
  • whatwhatwhat
    whatwhatwhat about 8 years
    Is this something I could set up so that I could use GUI's remotely from home based on a Debian server at school? My professor warned us that using the school's servers for any funny business will stand out and we will be reprimanded - would this get me in trouble? I want to use Gedit and Gnuplot that the servers at school have.