使用URL中的密码进行SSH登录 [英] SSH Login with Password in URL

查看:185
本文介绍了使用URL中的密码进行SSH登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我让詹金斯(Jenkins)在以下位置克隆了Git存储库

I have Jenkins cloning the Git repository at

ssh://user @ ip/repo/

ssh://user@ip/repo/

一切正常,但是我需要使用Jenkins不支持的密码登录.有没有办法使用URL中的密码登录?安全对我来说不是问题.它应该最终就存在了,我一开始就以为是这样:

and it all works fine, but I need to login with a password, which Jenkins doesn't support. Is there a way to login with the password in the URL? Security is not an issue for me. It should end up being, and I thought it was this at first:

ssh://user:pass @ ip/repo/

ssh://user:pass@ip/repo/

但是它不起作用.谢谢!

but it doesn't work. Thanks!

更新#1::git存储库位于同一服务器上.

Update #1: The git repo is on the same server.

推荐答案

SSH要求您输入密码有两个原因:

There are two reason why SSH ask you for a password:

  • 在服务器上找不到公钥,这意味着ssh默认为ssh会话所使用的帐户,要求输入密码
  • 找到了公共密钥,但私有密钥受密码保护.

第一种情况意味着ssh无法正常工作:您应该从不输入用于ssh的帐户的密码.
这个想法是即使所有ssh连接都将使用一个唯一帐户,也能够对某人进行身份验证.输入该唯一帐户的密码会达到目的.

The first case means ssh isn't working properly: you should never have to enter the password of the account you are using for ssh.
The idea is to be able to authenticate someone even though all ssh connections will use one unique account. Entering the password of that unique account defeat the purpose.

第二种情况应该很容易解决,方法是运行ssh-agentssh-add .
这样一来,您就可以输入密码(将密钥添加到代理程序时,输入密码不止一次).

The second case should be easy to solve, by running ssh-agent and ssh-add.
That would allow you to not enter the password (more than once, when adding the key to the agent).

这篇关于使用URL中的密码进行SSH登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆