Ssh – autofs can’t mount a remote dir with sshfs on the host with deprecated key algorithm

autofsautomounthostkeysshsshfs

Here is my configuration:

/etc/auto.master

/mnt/10       /etc/auto.10 uid=0,gid=0,--ghost

/etc/auto.10

root -fstype=fuse,allow_other,follow_symlinks,ssh_command=/etc/ssh/sshpass.10.sh    :sshfs\#root@10.28.0.10\:/root

Because the remote device is an appliance and it doesn't have an ability to save a key to do a passwordless login, I have to pass a password with an sshpass command. For that I used an ssh_command= parameter

/etc/ssh/sshpass.10.sh

#!/bin/bash

sshpass -f /etc/ssh/sshpass.10 ssh -o HostKeyAlgorithms=ssh-dss $*

I had to use -o HostKeyAlgorithms=ssh-dss in my ssh command config, because that appliance has an old openssh server. The device is out of production and doesn't do any more updates. When I ssh to it from my updated computer, it complains about no matching algorithms:

Unable to negotiate with 10.28.0.10 port 22: no matching host key type found. Their offer: ssh-dss

So, with a regular ssh, I have to do:

 ssh -o HostKeyAlgorithms=ssh-dss root@10.28.0.10

So, I did in /etc/ssh/sshpass.10.sh ssh setup file, as I stated above.

And the last file, has an ssh root password in it on the first line of a file with a line break.
/etc/ssh/sshpass.10
i.e.:

password

I am not able to show a line break here, though and of course, this is not the password, that I am using.

The problem:

When I try to go to the path, that was configured in these files, I can get to:
/mnt/10
and root folder appears there. I try to go inside of it, I get an error:

Can't access '/mnt/10/fsshroot/': No such file or directory

Best Answer

OK, I've figured it out. I tried to directly run:

sudo sshfs root@10.28.0.10:/root /tmp/10/ -o reconnect,allow_other,follow_symlinks,ssh_command='ssh HostKeyAlgorithms=ssh-dss'

and it gave me an error:

read: Connection reset by peer

So, it didn't work. I started looking for a way to fix it and found out, that in order to do it, I have to configure 2 lines in: /etc/ssh/ssh_config

Host 10.28.0.10
    HostKeyAlgorithms=+ssh-dss

Then, I removed:

 -o HostKeyAlgorithms=ssh-dss

from: /etc/ssh/sshpass.10.sh to make it like that:

#!/bin/bash

sshpass -f /etc/ssh/sshpass.10 ssh $*

Then, after restarting autofs service, it started working. My /mnt/10/root started displaying contents.