我已经使用PuTTYgen生成了密钥对,并一直使用Pageant登录,因此当系统启动时,我只需输入一次密码短语。
如何在Linux中实现这一点?我听说过钥匙串,但我听说它使用了不同的密钥对格式——我不想改变我的Windows密钥,如果我能在Windows和Linux中以相同的方式无缝连接就太好了。
我已经使用PuTTYgen生成了密钥对,并一直使用Pageant登录,因此当系统启动时,我只需输入一次密码短语。
如何在Linux中实现这一点?我听说过钥匙串,但我听说它使用了不同的密钥对格式——我不想改变我的Windows密钥,如果我能在Windows和Linux中以相同的方式无缝连接就太好了。
当前回答
如果你只有一个用户的putty格式的公钥,你可以把它转换成标准的openssh格式,如下所示:
ssh-keygen -i -f keyfile.pub > newkeyfile.pub
参考文献
来源:http://www.treslervania.com/node/408 镜子:https://web.archive.org/web/20120414040727/http: / / www.treslervania.com/node/408。
文章副本
I keep forgetting this so I'm gonna write it here. Non-geeks, just keep walking. The most common way to make a key on Windows is using Putty/Puttygen. Puttygen provides a neat utility to convert a linux private key to Putty format. However, what isn't addressed is that when you save the public key using puttygen it won't work on a linux server. Windows puts some data in different areas and adds line breaks. The Solution: When you get to the public key screen in creating your key pair in puttygen, copy the public key and paste it into a text file with the extension .pub. You will save you sysadmin hours of frustration reading posts like this. HOWEVER, sysadmins, you invariably get the wonky key file that throws no error message in the auth log except, no key found, trying password; even though everyone else's keys are working fine, and you've sent this key back to the user 15 times. ssh-keygen -i -f keyfile.pub > newkeyfile.pub Should convert an existing puttygen public key to OpenSSH format.
其他回答
或者,如果你想从一个PuTTY格式的密钥文件中获取私钥和公钥,你可以在*nix系统上使用puttygen。对于大多数基于apt的系统,puttygen是putty工具包的一部分。
从PuTTY格式的密钥文件中输出私钥。
$ puttygen keyfile。pem -O private-openssh -O avdev.pvk . pem
对于公钥:
$ puttygen keyfile.pem -L
新版本的PuTTYgen(我的是0.64)能够在.ssh/authorized_keys文件中显示要粘贴到linux系统中的OpenSSH公钥,如下图所示:
我最近从Linux的Putty转移到Linux的Remmina时遇到了这个问题。所以我在我的。Putty目录中有很多PPK文件,因为我已经使用它8年了。为此,我使用了一个简单的命令为bash shell做所有文件:
cd ~/.putty
for X in *.ppk; do puttygen $X -L > ~/.ssh/$(echo $X | sed 's,./,,' | sed 's/.ppk//g').pub; puttygen $X -O private-openssh -o ~/.ssh/$(echo $X | sed 's,./,,' | sed 's/.ppk//g').pvk; done;
非常快速和要点,得到的工作完成了所有的文件,腻子。如果它发现一个带有密码的密钥,它将停止并首先询问该密钥的密码,然后继续。
道克→PPK OpenSSH和PuttyGen RSA &。
私钥:
docker run --rm -v $(pwd):/app zinuzoid/puttygen private.ppk -O private-openssh -o my-openssh-key
公共密钥:
docker run --rm -v $(pwd):/app zinuzoid/puttygen private.ppk -L -o my-openssh-key.pub
参见https://hub.docker.com/r/zinuzoid/puttygen
如果你只有一个用户的putty格式的公钥,你可以把它转换成标准的openssh格式,如下所示:
ssh-keygen -i -f keyfile.pub > newkeyfile.pub
参考文献
来源:http://www.treslervania.com/node/408 镜子:https://web.archive.org/web/20120414040727/http: / / www.treslervania.com/node/408。
文章副本
I keep forgetting this so I'm gonna write it here. Non-geeks, just keep walking. The most common way to make a key on Windows is using Putty/Puttygen. Puttygen provides a neat utility to convert a linux private key to Putty format. However, what isn't addressed is that when you save the public key using puttygen it won't work on a linux server. Windows puts some data in different areas and adds line breaks. The Solution: When you get to the public key screen in creating your key pair in puttygen, copy the public key and paste it into a text file with the extension .pub. You will save you sysadmin hours of frustration reading posts like this. HOWEVER, sysadmins, you invariably get the wonky key file that throws no error message in the auth log except, no key found, trying password; even though everyone else's keys are working fine, and you've sent this key back to the user 15 times. ssh-keygen -i -f keyfile.pub > newkeyfile.pub Should convert an existing puttygen public key to OpenSSH format.