11

I'm new to ssh and linux in general. I've got putty set up and I can connect to my server and list files and everything. I'm wondering how I can edit a file using notepad++ (or another editor). Is there a way to have it automatically download and upload through ssh? How else do you edit a file?

Thanks

7 Answers 7

4

If you really need a GUI editor another alternative is to install on one on the server and run it via SSH.

To do this you need:

  • An X11 server on your guest that is running. (Xming works well - http://sourceforge.net/projects/xming/)
  • To permit X11 forwarding on the server adjust your /etc/ssh/sshd_config so this is set X11Forwarding yes. Restart ssh if you had to change.
  • To enable X11 forwarding through putty. (link)
  • To install a GUI editor on the server. I really like SciTE
  • With all the pieces in places, just open the file with editor filename and the GUI from the remote system will be displayed on your local machine.
10

You can use WinSCP and use sftp to edit your files. Just right click > edit. However, you'll have to login as root or a root level user to edit most system files which may be bad security practices.

The best thing for you to do is to use nano or a similar command line text editor and enable the color coding extensions, which is probably the point to use notepad++

2
  • use scp (instead of sftp) if you dont have ftp running Oct 4, 2013 at 7:23
  • SFTP doesn't use FTP. It handles it over SSH. It is default in most systems when installing OpenSSH. The only thing that needs to be enabled otherwise is the subsystem. Oct 21, 2013 at 12:55
8

There are a few options. On the Windows-friendly side of things, you could use Komodo Edit, which is free and has options to edit via SSH.

(I would recommend against using anything which only supports upload via FTP, since you're sending your credentials across the 'net in clear for anyone who wants to grab 'em.)

As others have indicated you could try out full-screen text editors like vi, Emacs, joe, or others to edit directly on the *ix system.

A final option would be to install Xming and use Unix GUI editors such as gedit remotely.

1

ssh is a terminal service, that means that you just send characters to the server that then interpret those into something useful like "edit a file".

That means that all programs execute on the computer where you are loged in.

So if you would like to use a local editor you must:

  1. copy the file home.
  2. Edit it with your editor
  3. Send it back.

A better way is to learn a powerful editor like vim/emacs and edit in place.

0

The easiest thing to do is use a text editor that supports ssh/sftp directly such as EditPlus or gedit.

0

Notepad++ has an FTP plugin. It might not come by default, I don't remember, but if it doesn't then it was easy to find on the Notepad++ website.

If you plan on using ssh to edit files often, I would recommend becoming familiar with an editor you can often find on Linux. Vi comes with all versions of Linux (VIM, Vi Improved, is frequently installed). Emacs is also common, and a lot of people use nano if they want something simple. These text editors, especially Vi, have a bit of a learning curve, but are worth it IMO if you plan on using them often, especially for programming.

0

I'd be lost without vim. Learn vi or vim and you will find it faster and more powerful for editing text files than most GUI editors.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .