ssh密钥短语在Windows中工作,但不在linux中 [英] ssh key passphrase works in windows but not in linux

查看:223
本文介绍了ssh密钥短语在Windows中工作,但不在linux中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在git中开展一个项目。
在Windows中,我使用git扩展来管理这个项目,并且访问公共存储库,他们给了我一个.ppk键。我将它加载到git扩展中,使用他们给我的密码,并且工作正常。

现在我设置了一个linux(ubuntu-32bit)虚拟机,并且我想要也可以从本机访问存储库。



从我在本站看到的另一个线程中,我使用克隆存储库的以下命令:

  ssh-agent bash -c'ssh-add /home/myHome/mykey.ppk; git clone git @serveraddress:project.git'

然后,shell告诉我插入密码

 输入/home/myHome/mykey.ppk的密码短语:

但是当我插入它时,它告诉我这是一个不好的密码。我已经检查了很多次,并且我确定我使用的是我在Windows中使用的相同密码。那么我该如何正确使用Linux中的密钥呢?



感谢您的回复。 方案

Linux SSH客户端(通常是OpenSSH)无法读取Windows SSH客户端Putty使用的PPK格式。您需要先将提供给您的PPK密钥转换为OpenSSH密钥。在Linux上安装putty并使用 puttygen 命令行工具:

  $ sudo aptitude install putty 
$ mkdir -p〜/ .ssh
$ puttygen〜/ mykey.ppk -o〜/ .ssh / id_rsa -O private-openssh
〜/ .ssh /中找到与OpenSSH兼容的密钥。 。之后,您可以使用 ssh-add (不带任何参数!)将此密钥添加到SSH代理中。



或者,您可以使用Windows上由putty提供的PUTTYgen程序。


I'm working to a project in git. In Windows, I'm using git extensions to manage this project, and to access to the public repository they gave me a .ppk key. I load it into git extension, with the passphrase that they gave me, and it works.

Now I set a linux (ubuntu-32bit) virtual machine, and I want to access also from this machine to the repository.

From another thread that I've seen in this site, I use, to clone the repository, the following command:

ssh-agent bash -c 'ssh-add /home/myHome/mykey.ppk; git clone git@serveraddress:project.git'

Then, the shell tells me to insert the passphrase

Enter passphrase for /home/myHome/mykey.ppk:

But when I insert it, it tells me that's a bad passphrase. I've checked it a lot of times, and I'm sure that I use the same passphrase that I use in windows. So how can I use correctly the key in Linux?

Thanks in advance for your replies.

解决方案

The Linux SSH client (typically OpenSSH) can't read the PPK format used by the Windows SSH client Putty. You need to convert the "PPK" key given to you into an OpenSSH key first. Install "putty" on Linux and use the puttygen command line tool:

$ sudo aptitude install putty
$ mkdir -p ~/.ssh
$ puttygen ~/mykey.ppk -o ~/.ssh/id_rsa -O private-openssh

Enter your passphrase, and you'll get an OpenSSH-compatible key in the standard location ~/.ssh/id_rsa. Afterwards you can just use ssh-add(without any arguments!) to add this key to the SSH agent.

Alternatively you can use the PUTTYgen program provided by putty on Windows.

这篇关于ssh密钥短语在Windows中工作,但不在linux中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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