Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

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.

share|improve this answer
    
That might be what I'm looking for. Sorry, haven't 15 pts to vote this up. –  culebrón Oct 9 '09 at 12:31
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
    
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 '09 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." –  quack quixote Oct 8 '09 at 14:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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