Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a server I can ssh into, and I am also running Ubuntu. How do I edit this remote file using any program I have installed on my local Ubuntu, without copying it to local, editing it, and copying it back?

Thanks!

share|improve this question
up vote 7 down vote accepted

If it's Ubuntu, then you probably have the full GNOME suite installed, along with GVFS – so you can access sftp:// URLs directly in all apps.

  • Use Places → Connect to Server to connect that server's filesystem as if were a local one.

  • Do the same from command line using

    gvfs-mount sftp://hostname.domain.tld/

While GVFS is specific to GNOME apps, all mounted GVFS locations are accessible by any program via /run/<user>/gvfs (or ~/.gvfs/ in older versions).

KDE programs also support sftp:// via KIO, although they don't have the equivalent of /run/<user>/gvfs.

share|improve this answer
    
Super-awesome. I never knew about this, thanks for your help! – ash May 26 '10 at 22:08
1  
+1 for comment about hidden directory. – liori May 27 '10 at 8:07

Try sshfs, a program that allows to mount a remote system accessible via ssh to a local folder.

Install it, create a mount point and execute:

sshfs user@host:remote_dir /path/to/mount_point

Now you can access the remote directory as a local one and you can use your text editor of choice. Moreover, you can use sshfs as an on-demand video/music streaming solution (see this answer).


Example: if you want to mount the directory music of a user called pippo at host pluto in a folder ./pippo_music then execute:

sshfs pippo@pluto:music ./pippo_music

You can also mount the root of the pluto host with:

sshfs pippo@pluto:/ ./pippo_root

To automate this process, add a row in fstab:

sshfs#pippo@pluto:/ /media/pippo_root fuse defaults 0 0
share|improve this answer
    
I tried to do this and edit some text files with sublime text, but it didn't work. I could open the files, but when I hit save it wouldn't propagate back to the server. Sometimes it would ask me for a password to save, and I'd type it in, but still no dice. – Nick Retallack Jul 7 '14 at 3:55
    
Never seen that. Try with a different text editor. Also, check the permissions of the file you are editing. – mrucci Jul 7 '14 at 18:36

Update on an old question:

KDE supports a FIle over SsH protocol called fish. Basically, you open your file as URL with the fish:// scheme referring to the file. KDE copies the file over locally to a temp file as you edit. Saves and a quit will push the file back to the remote server.

e.g.

kate fish://user@host:/path/to/file.txt

There's a wrapper for non-KDE editors (or any tools):

kioexec other-editor-or-tool fish://user@host:/path/to/file.txt

Remember that you probably have the KDE libs on your machine, even if you run GNOME desktop or something else.

share|improve this answer
1  
kate file://user@host:/path/to/file.txt is not correct. fish instead file should be used. kate fish://user@host:/path/to/file.txt – user476860 Aug 2 '15 at 9:51
    
@Matth yeah, dumb typo. Fixed – Rich Homolka Aug 7 '15 at 18:30

Tramp node in emacs will do this easily: http://www.emacswiki.org/emacs/TrampMode

share|improve this answer
    
Damn I wish vim had su:// – grawity May 27 '10 at 12:01

vim can open files over SSH:

vim scp://myserver.com/path/to/file.txt
share|improve this answer

You must log in to answer this question.

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