Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Handshake failed: ssh: unable to authenticate

未关闭
#69 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
docker, go

调研方向

从 utils.RunSSHCommand 和 issue 中显示的 easyssh.MakeConfig 值开始,然后使用 docker-compose 针对 /root/.ssh/id_rsa 的卷映射重现身份验证失败。将容器的 SSH 环境与主机进行比较,并确认身份验证所需的配置;完成的标准是记录下原因和经过验证的解决方案。

由索引模型根据 Issue 内容生成。

描述

Hi, I'm trying to run a remote command to a host but it fails with the following error message and I can't find what is wrong:

ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

Here is the code:

const (
    PKEY = "/root/.ssh/id_rsa"
)
...
output, err := utils.RunSSHCommand(user, host, PKEY, "cat /some/file")
...
func RunSSHCommand(user, addr, key, cmd string) (string, error) {
	ssh := &easyssh.MakeConfig{
		User:    user,
		Server:  addr,
		KeyPath: key,
		Port:    "22",
		Timeout: 60 * time.Second,
	}
	stdout, stderr, done, err := ssh.Run(cmd, 60*time.Second)
	if err != nil {
		color.Error.Printf("[SSH Error] Cant run remote command (%s), error msg: %s\n", cmd, err.Error())
	} else {
		if done {
			return stdout, err
		} else {
			color.Error.Printf("[SSH Error] Command error execution msg: %s\n", stderr)
		}
	}
	return "", err
}

Any ideas of what could be the problem here? I've already check that the key exists. I'm running this code from a docker container, and I pass the private key from the server running the container to the container it self on the docker-compose file like these:

...
volumes:
- /root/.ssh/id_rsa:/root/.ssh/id_rsa
...
主要语言
Go
星标
349
派生
64
平均合并
2 小时 29 分钟
30 天内合并 PR
2

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

appleboy/easyssh-proxy 的其他 Issue

查看 appleboy/easyssh-proxy 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。