1

Is there a way to configure the automounter (either Linux or OSX) with FUSE sshfs so that cd /servers/<server> will automount the correct server with sshfs?

1 Answer 1

1

I just replied with an example answer to another question (autofs+sshfs-answer)

Remember! Autofs user by default is root. So get sshfs working with root first.

auto.master line

note! use your own uid and gid and specify your prefered mount point I use /auto/mehtod/address

/auto/sshfs /etc/auto.sshfs uid=1000,gid=1000,--timeout=60,--ghost

auto.sshfs this is a bit more generic than just one mount

#!/bin/bash

# Shell script that acccepts one argument, namely userid@server
# env >> /tmp/env_check
# whoami >> /tmp/env_check

key=$1
USER='your_local_user_used_for_ssh_identity_file'
REMOTEDEFAULT='default_to_this_user_otherwise_root'
key=${key//[: #]/}

# add user
[[ ! "$key" =~ "@" ]] && key="${REMOTEDEFAULT}@${key}"

case $key in
   ${REMOTEDEFAULT}@.Trash*)
      exit 1;;
   *)
      (
      echo "-fstype=fuse,idmap=user,rw,nodev,nonempty,transform_symlinks,noatime,allow_other,IdentityFile=/home/${USER}/.ssh/id_dsa,max_read=65536\\"
      echo -e "\t /uhome :sshfs\#$key\:\\"
      echo -e "\t /tmp :sshfs\#$key\:\/tmp\/\\"
      echo -e "\t /rootfs :sshfs\#$key\:\/")
esac

## this is a bit more complex. It creates subfolders to autofs-mount/remotename
## /uhome  = your remote homedirectory
## /rootfs = remote root '/'
## /tmp    = remote tmp # same as /roots/tmp

then link to folder you want to access ln -s /auto/sshfs/[email protected]/uhome/ remote-home

You must log in to answer this question.

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