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

A is a Mac Os X 10.7.2 host and B is an ArchLinux VM running in A. I can ssh from A to B and from B to A using an authentication key. I want B to mount itself in A using sshfs when it starts.

Why does this work ...

X@B $ ssh A
X@A $ sshfs B: Desktop/B/
X@A $ ls Desktop/B/
Desktop/      Downloads/    Temp/         bin/

... and this doesn't?

X@B $ ssh -t A "/opt/local/bin/sshfs B: Desktop/B/"
Enter passphrase for key '/Users/X/.ssh/id_dsa': 
Connection to A closed.
-- then back on A: --
X@A $ ls Desktop/B/

Why does the first scenario works without any problem when the second does not?

I also tried the dual operation (mounting A in B instead of B in A) and the second scenario does not work better. I use the -t to be able to type my passphrase and I don't care about typing it for this question (aka don't suggest me to forward my agent it's not the question...).

Here are my versions:

X@A $ sshfs -V                                                                                                                                                                                                 
SSHFS version 2.3
fuse4x library version: FUSE 2.8.6 / fuse4x 0.8.13

X@B $ sshfs -V
SSHFS version 2.3
FUSE library version: 2.8.6
fusermount version: 2.8.6
using FUSE kernel interface version 7.12
share|improve this question

migrated from Nov 12 '11 at 15:19

This question came from our site for professional and enthusiast programmers.

I don't have osx at hand, but the reason for your problem is most likely same as why it won't work with linux either.

The problem is that sshfs is connected to a terminal and disconnecting closes said terminal and closes your mount.

This can be tested with:

ssh -t A "/opt/local/bin/sshfs B: Desktop/B/ ; sleep 60"

and check that mount worked. After 60 seconds it should disappear.

One way to solve this is to use nohup or something similar.

ssh -t A "nohup /opt/local/bin/sshfs B: Desktop/B/"

Please note that you will not see passphrase dialog, but you can still input your passphrase. (Or at least it worked with password)

share|improve this answer

You must log in to answer this question.

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