How do you edit files over SSH?

Solution 1:

Maybe you should simply mount the remote filesystem to your local machine and then use whatever editor you like. If running a Debian derivative, install sshfs

sudo apt-get install sshfs

and then mount the remote filesystem ( issue on your local machine )

mkdir ~/remote_code
sshfs [email protected]:/home/$USER/code ~/remote_code

Once this is done you can access the code in ~/remote_code w/ any of your GUI tools and without the bandwidth overhead of using ssh -X (however you still need a good connection w/ a low ping time).

PS: When using ssh I can make the terminal as wide as it fits my screen and then use its full width, so I fear I don't completely understand your issue.

Solution 2:

WinSCP is a SSH client ftp-like. The default editor is primitive but can be change.

Solution 3:

There are various options.

You can make the terminal larger. ;)

If you have a graphical environment installed on the machine you are ssh'ing into, you can login with ssh -X (or xdeep-putty if you are on Windows) to enable window forwarding. You can then run your favourite editor on the remote machine, whose graphical output is forwarded.

Finally, you can mount the ssh connection into your file system, using for example fuse (similar options might exist for non-linux operating systems). That allows you to access any file on the remote machine as if it were in your filesystem, with your favourite editor, locally.

Solution 4:

I'm not 100% sure if this works for files owned by root, but if your desktop is KDE & your remote system is Linux (or pretty much any form of *nix), you can get konqueror to access the remote machine using the "fish://" protocol. From there you can open the file from konqueror using kate, or your preferred editor, and konqueror will take care of copying the file to your local machine and copying it back when you save.

Failing which the X11 forward is a good option, but X11 over ssh to remote sites can be slow. "ssh -X -C" compresses the data stream and can give better performance.