问题描述
注意 panubo/sshd 是一个 docker 镜像。 (它似乎是评分最高的一个,这就是我选择它的原因。)
我已经能够很好地运行它 --- 做各种事情。我似乎无法做到的是用我自己的替换它的 /etc/ssh/sshd_config
。请注意,这是支持的。 homepage says
使用以下环境变量配置容器或选择在 /etc/ssh/sshd_config
安装自定义 sshd 配置:
我想替换它,因为我想设置诸如 ListenAddress
之类的指令。每当我尝试更换它时,都会出现以下错误:
#docker run -v $(pwd)/sshd_config:/etc/ssh/sshd_config docker.io/panubo/sshd:latest
> Starting SSHD
>> Generating new host keys
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
error: Failed to execute command
saving failed (run 'errors' for details)
#
起初我尝试使用我自己的 sshd_config
,它可以在我的机器上运行。但是由于我的机器和这个 docker 镜像正在运行两个不同版本的 SSHd,我决定清空 sshd_config 文件,以便它采用所有默认值。但它以同样的方式失败。我不知道如何获取错误的详细信息,因此获取此类错误也可以回答这个问题。
根据@DavidMaze 的想法输出 DEBUG=true。
#docker run -v $(pwd)/sshd_config:/etc/ssh/sshd_config -e DEBUG=true docker.io/panubo/sshd:latest
> Starting SSHD
+ DAEMON=sshd
+ echo '> Starting SSHD'
++ ls -A /etc/ssh
>> Generating new host keys
+ '[' '!' 'moduli
ssh_config
sshd_config' ']'
+ ls '/etc/ssh/keys/ssh_host_*'
+ ls '/etc/ssh/ssh_host_*'
+ echo '>> Generating new host keys'
+ mkdir -p /etc/ssh/keys
+ ssh-keygen -A
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
+ mv /etc/ssh/ssh_host_dsa_key /etc/ssh/ssh_host_dsa_key.pub /etc/ssh/ssh_host_ecdsa_key /etc/ssh/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ed25519_key /etc/ssh/ssh_host_ed25519_key.pub /etc/ssh/ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key.pub /etc/ssh/keys/
+ set_hostkeys
+ printf '%s\n' 'set /files/etc/ssh/sshd_config/HostKey[1] /etc/ssh/keys/ssh_host_rsa_key' 'set /files/etc/ssh/sshd_config/HostKey[2] /etc/ssh/keys/ssh_host_dsa_key' 'set /files/etc/ssh/sshd_config/HostKey[3] /etc/ssh/keys/ssh_host_ecdsa_key' 'set /files/etc/ssh/sshd_config/HostKey[4] /etc/ssh/keys/ssh_host_ed25519_key'
+ augtool -s
error: Failed to execute command
saving failed (run 'errors' for details)
#
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)