从Jenkins docker容器到远程主机的SSH
我正在运行docker容器,作为一项工作的一部分,我必须通过ssh连接到远程主机,并在远程主机上执行一些命令。 我遵循以下方法从Jenkins docker容器到远程主机的SSH,docker,Docker,我正在运行docker容器,作为一项工作的一部分,我必须通过ssh连接到远程主机,并在远程主机上执行一些命令。 我遵循以下方法 启动了Jenkins容器,运行正常 检查我是否能够ping远程实例,它工作正常。此外,我能够ssh与密码 现在我已经在docker容器中生成了公钥和私钥,并将公钥推送到远程主机的授权密钥中 当我尝试使用无密码SSH时,它将使用密码方法 下面是调试模式的输出- debug1: rekey after 134217728 blocks debug2: key: /var/j
debug1: rekey after 134217728 blocks
debug2: key: /var/jenkins_home/.ssh/id_rsa (0x56281fc480e0)
debug2: key: /var/jenkins_home/.ssh/id_dsa ((nil))
debug2: key: /var/jenkins_home/.ssh/id_ecdsa ((nil))
debug2: key: /var/jenkins_home/.ssh/id_ed25519 ((nil))
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug2: we did not send a packet, disable method
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
debug1: Unspecified GSS failure. Minor code may provide more information
No Kerberos credentials available (default cache: FILE:/tmp/krb5cc_1000)
debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/jenkins_home/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /var/jenkins_home/.ssh/id_dsa
debug1: Trying private key: /var/jenkins_home/.ssh/id_ecdsa
debug1: Trying private key: /var/jenkins_home/.ssh/id_ed25519
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
debug1:在134217728块之后重新键入
debug2:key:/var/jenkins\u home/.ssh/id\u rsa(0x56281fc480e0)
debug2:key:/var/jenkins\u home/.ssh/id\u dsa((nil))
debug2:key:/var/jenkins\u home/.ssh/id\u ecdsa((nil))
debug2:key:/var/jenkins\u home/.ssh/id\u ed25519((nil))
debug1:SSH2\u MSG\u EXT\u接收到信息
debug1:kex_输入_外部_信息:服务器信号algs=
debug2:service\u accept:ssh userauth
debug1:SSH2\u消息\u服务\u接收
debug1:可以继续的身份验证:公钥、gssapi keyex、带麦克风的gssapi、密码
debug1:下一个身份验证方法:gssapi-keyex
debug1:没有有效的密钥交换上下文
debug2:我们没有发送数据包,请禁用方法
debug1:下一个身份验证方法:带麦克风的gssapi
debug1:未指定的GSS故障。次要代码可能提供更多信息
没有可用的Kerberos凭据(默认缓存:文件:/tmp/krb5cc_1000)
debug1:未指定的GSS故障。次要代码可能提供更多信息
没有可用的Kerberos凭据(默认缓存:文件:/tmp/krb5cc_1000)
debug2:我们没有发送数据包,请禁用方法
debug1:下一个身份验证方法:公钥
debug1:提供RSA公钥:/var/jenkins\u home/.ssh/id\u RSA
debug2:我们发送了一个公钥包,等待回复
debug1:可以继续的身份验证:公钥、gssapi keyex、带麦克风的gssapi、密码
debug1:正在尝试私钥:/var/jenkins\u home/.ssh/id\u dsa
debug1:正在尝试私钥:/var/jenkins\u home/.ssh/id\u ecdsa
debug1:正在尝试私钥:/var/jenkins\u home/.ssh/id\u ed25519
debug2:我们没有发送数据包,请禁用方法
debug1:下一个身份验证方法:密码
不确定我遗漏了什么,因为我在从docker主机到远程机器执行无密码SSH时采用了完全相同的方法,并且工作正常
非常感谢您的帮助。解决了问题。
为sshd启用日志记录,并在/var/log/messages中发现错误,表明主文件夹上的权限不正确
下面两个链接帮助解决了这个问题-
解决了这个问题。
为sshd启用日志记录,并在/var/log/messages中发现错误,表明主文件夹上的权限不正确
下面两个链接帮助解决了这个问题-
你确定服务器支持RSA密钥吗?如果你说的是Docker主机或远程服务器,请告诉我,我可以在Docker主机和远程服务器之间执行无密码ssh。你确定服务器支持RSA密钥吗?如果你说的是Docker主机或远程服务器,请告诉我,仅供参考,我能够在Docker主机和远程服务器之间进行无密码ssh。