Jenkins通过SSH身份验证发布失败,并带有私钥 [英] Jenkins Publish over ssh authentification failed with private key
问题描述
我可以使用我的private key
和密码在服务器上的putty
上成功进行身份验证.但是,当我尝试使用jenkins 通过SSH发布插件(使用测试进行配置")来执行此操作时,出现以下错误消息:
I can authenticate successfully with putty
on the server with my private key
and passphrase. But when I try to do it with jenkins publish over SSH plugin (using Test for configuration), I get the following error message:
jenkins.plugins.publish_over.BapPublisherException: Failed to connect session for config myconfig. Message [Auth fail]
我输入了与腻子相同的信息:
I entered the same information as in putty:
主机名:myhostname
用户名:myusername
远程目录:
使用密码身份验证,或使用其他密钥密码/密码
密钥路径:已选中
密钥路径:mypath
密码短语:mypasssword
键:
端口:22
超时(毫秒):300000
Hostname : myhostname
Username : myusername
Remote Directory :
Use password authentication, or use a different key Passphrase / Password
Path to key : checked
Path to key : mypath
Passphrase : mypasssword
Key:
Port:22
Timeout(ms):300000
如果您有任何想法... 感谢您的帮助.
If you have any idea ... Thanks for your help.
推荐答案
您似乎正在使用密钥文件身份验证,因此,如果您未正确设置.ssh
文件夹的权限,则会从Jenkins收到此错误和/或~/.ssh/authorized_keys
文件.
Looks like you're using keyfile authentication, so you'll get this error from Jenkins if you haven't set the permissions correctly on your .ssh
folder and/or ~/.ssh/authorized_keys
file.
-
.ssh
文件夹应具有drwx------
权限(仅读取/写入/执行所有者) -
authorized_keys
文件应具有-rw-------
权限(仅读/写所有者)
- the
.ssh
folder should havedrwx------
permissions (read/write/execute owner only) - the
authorized_keys
file should have-rw-------
permissions (read/write owner only)
要修复它:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
这篇关于Jenkins通过SSH身份验证发布失败,并带有私钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!