Sshfs reconnect

Для ботов

Oh no! Some styles failed to load. 😵

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I use sshfs to connect to a remote server. When my computer goes to sleep or internet drops, sshfs tries to reconnect when the connection comes back, but does not ask me for a password. Because of this, the reconnect fails, and after several attempts my IP address is blocked indefinitely from connecting to the server until I convince them to unblock me. Overall this is completely untenable. How can I prevent sshfs from reconnecting? How are we doing? Please help us improve Stack Overflow. Take our short survey. Learn more. Prevent sshfs reconnecting Ask Question. Asked 4 days ago. Active 4 days ago. Viewed 8 times. Ben Southworth Ben Southworth 1 1 silver badge 8 8 bronze badges. Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Cryptocurrency-Based Life Forms. Q2 Community Roadmap. Featured on Meta.

Subscribe to RSS


By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up. This is important but largely undocumented. I regard this a useless behavior. A typical application becomes entirely hung as a result. Autossh automatically reconnects ssh sessions when it notices ssh has died or stopped passing traffic. Since it is just automated ssh, it will work from different IP's and from suspend even if the laptop wakes up on a different lan. One thing you could do is mount your filesystems via autofs. Autofs is a tool that will mount a filesystem when you to use something in the directory that the filesystem will be mounted to. When it detects activity the filesystem is mounted. When nothing is happening on the filesystem is it unmounted. Here is a howto I found on google to accomplish this, there where several others. I suspect there isn't, because even if you can configure your SSH client not to drop the connection, the server might be configured to do so after a specified period of inactivity, and you wouldn't be able to override that. Even if you could, if you never resume the connection, the server would be left hanging, and over time that could lead to a significant waste of server resources. A better technique, I think, is to unmount the filesystem before suspending your computer and remount it when the computer wakes up again. The mechanism for doing so may depend on exactly how you suspend your computer - I use the tuxonice kernel and to do something like this I have a directive like. The answer of kubanczyk is great. I had a problem with freezing entire the interface because of too greedy sshfs, now for easy connection started by a script that reconnects when laptop is opened and that does not freeze when the connection gets slower, you can use a bash script like that maybe not very secure, but convenient for many web projects for example :. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Asked 10 years, 11 months ago. Active 10 months ago. Viewed 39k times. Active Oldest Votes. This made it for me. Also you can use a shorter interval, afaik it shouldn't cause too much trouble and makes the whole thing more responsive. I assume your solution gives it 3 retries after each failure? If three consecutive pings fail 45 secondsreconnect. If there is a failure, it will try reconnecting 3 more times and then give up. At some point retrying is futile, but that depends on the application. Then again, I think the man page could be more specific, there's different ways to interpret the way it's worded IMO.

Oh no! Some styles failed to load. 😵


By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. It only takes a minute to sign up. I have several directories mounted through sshfs. I sometimes get disconnects from the server not configurable by me. I usually mount the directories like this. The mount is still visible when typing mount. When I type. Is there a better way to deal with this? Obviously sshfs should do the umount and clean up Ideally it would reconnect automatically. You can run sshfs with the "reconnect" option. We use -o reconnect as parameter for sshfs, mostly because our users suspended their computers and on wake sshfs would not reconnect or respond, or anything. Just a note, if the remote computer is really down, sshfs may become unresponsive for a long time. This can be worked around by decreasing the timeout. I have a server that I use for storage and for some lack of space where I live, I keep it in another location. In order to bring the files into my network I use a raspberry pi that mount the files from the server using sshfs. Recently I had to upgrade to raspbian jessie due to a power failure and realised that sshfs become seriously unstable. The folders would be properly mounted but after some time I would not be able to connect to them and the raspberry pi would freeze if I wanted to list the contents of the mounts. And it works! No more disconnects! I looks like sshfs does not read the ssh config file for some reason and the keep alive signals were never sent. This sounds like a job for autofs. It's rather adept at handling network mounts of various kinds nfs, samba, sshfs, you name it and noticing when those things need re-mounting. It can also takes care of unmounting them after periods of disuse and mounting them when a file system request is made. If there are still people encountering this problem, I still could not fix it. I did find a working workaround. The following ruby script did the trick. It creates a folder called "keepalive" over and over. Just keep running this until infinity.

SSHFS: Mounting a remote file system over SSH


By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up. Very occasionally the connection will be broken if there's a power or Internet outtage, and in these cases I would have to recognise this has happened and manually reconnect using the same command. Is there a way I can get my Ubuntu Server to automatically attempt to reconnect, say every 30 seconds, if the connection goes down? I am duplicating it here. The result is that if the server is unavailable for 1 minute, sshfs will reconnect to the server. Ubuntu Community Ask! Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Asked 4 years, 3 months ago. Active 4 years, 3 months ago. Viewed 19k times. Ozzah Ozzah 3 3 gold badges 7 7 silver badges 16 16 bronze badges. Active Oldest Votes. Seth Difley Seth Difley 6 6 silver badges 9 9 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Cryptocurrency-Based Life Forms. Q2 Community Roadmap. Featured on Meta. Community and Moderator guidelines for escalating issues via new response…. Feedback on Q2 Community Roadmap. Linked 7. Related Hot Network Questions. Question feed. Ask Ubuntu works best with JavaScript enabled.

SSHFS: Mounting a remote file system over SSH

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. It only takes a minute to sign up. I have a remote sshfs drive that I use on a daily basis. I previously executed the following command every time I booted up my computer. Obviously, it's not super convenient to do that by hand every time, so I thought I'd just add the remote to my file systems table. Unfortunately, if there is a blip in the network, the drive sometimes goes down. This happens maybe once per day -- and when I try to manually reconnect by clicking on the drive in nautilusI'm given a message that says "Transport endpoint is not connected. My primary question is this: how can I bring the -o reconnect option that I used in the terminal command into my fstab file? I believe that would prevent the drive disconnect due to blips. Also, I chose that cipher because it's the quickest one my remote server supports I thinkand removed compression because the wired gigabit network is faster than the time taken by the CPU to compress stuff. It would be great if I could pull those options into my fstab as well, but I can live without them. To include the options you want, you should modify your fstab entry as shown below. Be careful, as adding an option that doesn't actually exist will cause your system not to boot. I took the liberty of adding the noauto option. This requests that the mount won't happen automatically, so that any failure will not stop the boot process particularly when using systemd. It relies on you having a convenient way of running mount. Hopefully your filemanager will provide this, otherwise it defeats the point Another possibility is the nofail option. This option requests a successful boot even if this filesystem fails to mount "this device if it does not exist". Ironically, using the nofail option here will guarantee failure. It is formatted as a comma-separated list of options. It contains at least the type of mount ro or rwplus any additional options appropriate to the filesystem type including performance-tuning options. For details, see mount 8 or swapon 8. Options which are completely filesystem-independent are handled by fstab.

Ubuntu: SSHFS - auto reconnect



Comments on “Sshfs reconnect

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>