0

I have two Centos 7 servers and I mounted a directory from the 2nd server on the 1st one by SSHFS. And it works fine.

but when I reboot the 1st server I need to mount the directory manually.

What configuration does it need to mount the directory automatically after reboot? I tried fstab but it must contain the password of 2nd server and I don't know the correct syntax.

1 Answer 1

0

First you need to configure ssh key based authentication here's example, then configure automoint using fstab. Correct syntax is:

user@host:/remote/folder /mount/point fuse.sshfs noauto,x-systemd.automount,_netdev,users,idmap=user,IdentityFile=/home/user/.ssh/id_rsa,allow_other,reconnect 0 0

The important mount options here are noauto,x-systemd.automount,_netdev.

  • noauto tells it not to mount at boot;
  • x-systemd.automount tells device to mount only when accessed;
  • _netdev tells it that it is a network device, not a block device (without it "No such device" errors might happen).

You must log in to answer this question.

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