大网数据广告活动
服务器运维问答

autofs can't mount a remote dir with sshfs on the host with deprecated key algorithm

· 52CE 我爱测

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\#[email omitted]\:/root Because the remote d…

问题原文

原帖链接 · igoryonya · CC BY-SA 3.0

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\#[email omitted]\:/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 [email omitted]

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

已采纳解答

原帖链接 · igoryonya · CC BY-SA 3.0

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

sudo sshfs [email omitted]:/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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-03-28)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。