1

I want to mount partitions from a remote NAS that doesn't support login with a certificate.

I created or edited the following files:

  • /etc/ssh/sshpass.232 with ssh password

  • /etc/ssh/sshpass.232.sh with execute permissions and the following content:

    #!/bin/bash
    sshpass -f /etc/ssh/sshpass.232 ssh $*
    
  • /etc/auto.master with the following content:

    /mnt/232       /etc/auto.232  uid=0,gid=0,--ghost
    
  • /etc/auto.232 with the following content:

    serverroot -fstype=fuse,allow_other,follow_symlinks,ssh_command='/etc/ssh/sshpass.232.sh'  :sshfs\#user@sshfs_server_ip\:/mount_path
    

Then I restarted the autofs service:

sudo systemctl restart autofs.service

I tried to run ls /mnt and saw that /mnt/232 appears in the /mnt folder. Then I ran ls in /mnt/232/ and I saw that the the folder /mnt/232/serverroot is there. But when I try ls /mnt/232/serverroot, it says:

ls: cannot access '/mnt/232/serverroot/': No such file or directory

If I do it manually with mount:

sshfs -o allow_other,follow_symlinks,ssh_command='/etc/ssh/sshpass.232.sh' user@sshfs_server_ip:/mount_path /mnt/232/serverroot

It works flawlessly. Also, if I do a cifs config with autofs, it works fine. What am I doing wrong?

  • Did you try removing the single quotes from /etc/auto.232, as you dont need them and in your manual mount they are effectively removed by the shell. – meuh Aug 27 '17 at 9:37
  • At 1st, I wanted to remove the single quotes, then, while troubleshooting, effectively forgot about it. I've removed them now and it worked! Thanx! – igoryonya Aug 29 '17 at 23:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.