When I mount sftp/ftp, and connection breaks for a while, the mount "freezes" and will freeze any process that deals with it (the editor, Nautilus, umount, etc). I can't even unmount the folder. (My system is Ubuntu 9.10)

What's the way to edit files on that sftp/ftp folder without mounting it, in order to avoid these freezes?

A more detailed explanation:

I work as a web programmer, and have to edit a lot of files on a commercial web hosting. I sshfs (mount) an sftp folder to /media/project1 and edit files there. Our corporate LAN uses ADSL which disconnects briefly every half an hour (I don't notice that, but my sshfs does). After a disconnect, web borwsers work fine, but /media/project1 is not accessible. Any process that touches /media/project1 after that, becomes Uninterruptible, hence killall, kill -9 PID have no effect for 5-15 minutes.

When this happens, my editor freezes, I can't edit anything, nor can unmount the folder. I could run another instance of the editor, mount the sftp in yet another folder, but this is labor- and memory-intensive.

I'll appreciate any ideas to avoid this.


3 Answers 3


You can use sshfs with autossh to create a respawning sshfs mountpoint. I haven't done it myself, but I plan to, and howtos are readily available on google search.

  • That might be what I'm looking for. Sorry, haven't 15 pts to vote this up.
    – culebrón
    Oct 9, 2009 at 12:31

You might consider working over an ssh connection, directly editing on the target servers.

Or copying the files locally, and then pushing them back when they've been updated appropriately.


All network drive technologies suffer from the problem you experienced; if you open files on the drive, and the network connection gets cut, any program trying to access the drive will freeze.

A safer method is:

  1. Download the files you need to edit via scp/sftp and put them in some local folder.

  2. Edit the files locally.

  3. Upload the edited files back to the server via scp/sftp.

An alternate method (expanding on something warren mentioned, but this only works if your editing can be done inside a terminal -- no GUIs allowed):

  1. ssh to the remote computer.

  2. run "screen", to protect your editing against disconnections.

  3. edit the files with your preferred editor (vi/m, emacs, nano, whatever), or run commandline tools for multimedia processing.

  4. if disconnected, reconnect with ssh and run "screen -D -R" to get back to your previous session.

  • I think the options are -d -r for disconnect and reconnect... though if you lose your main terminal, a -r is generally sufficient, in my experience :)
    – warren
    Oct 8, 2009 at 13:55
  • from the manpage: "-D -R Attach here and now. In detail this means: If a session is running, then reattach. If necessary detach and logout remotely first. If it was not running create it and notify the user. This is the author's favorite." it's mildly overkill for MOST situations, but i find it good habit. i also like: "-D -RR Attach here and now. Whatever that means, just do it." Oct 8, 2009 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.