2

The solution to having a dynamic /nfs dir proved to be extremely simple: https://unix.stackexchange.com/a/584475/2972

I am wondering if I can do the same for sshfs.

Let us assume that I can run:

sshfs remote.server: /sshfs/remote.server

without entering passphase (I use ssh-agent).

Is it possible for me to make an sshfs.autofs config that will run this no matter what remote.server I enter?

So that no matter the remote.server this would work:

cd /sshfs/remote.server/dir-on-remote.server

as long as the manual sshfs remote.server: /sshfs/remote.server would work.

The only answers I have been able to find lists the exact servers to use. So if I want to use those solutions, I need to know the servers in advance.

I can see the use of that, but I would (just like with nfs) prefer a config, where I do not have the know the servers in advance, and which will use the login config from ~/.ssh/config - just like sshfs does when run manually.

I will be using this from my personal computer, so it is not a big risk if other users on my personal computer can see the password or can access the files as me.

1

1 Answer 1

1

A workaround is to use afuse:

afuse -o mount_template="sshfs %r:/ %m" -o unmount_template="fusermount -u -z %m" /sshfs

It does not use autofs, but it seems to work.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.