How do I install a ssh private key generated by puttygen?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
42
down vote
favorite
I set up my linux server to accept connections from my home PC by adding the public key generated by puttygen to the authorized_keys file.
Now I'm trying to connect to the same machine, but this time from another Ubuntu machine. I have to use the same private key (for a weird reason, don't ask..) and I don't quite get how to install it on my client Ubuntu.
Do I have to convert it to some other format?
ssh
add a comment |Â
up vote
42
down vote
favorite
I set up my linux server to accept connections from my home PC by adding the public key generated by puttygen to the authorized_keys file.
Now I'm trying to connect to the same machine, but this time from another Ubuntu machine. I have to use the same private key (for a weird reason, don't ask..) and I don't quite get how to install it on my client Ubuntu.
Do I have to convert it to some other format?
ssh
add a comment |Â
up vote
42
down vote
favorite
up vote
42
down vote
favorite
I set up my linux server to accept connections from my home PC by adding the public key generated by puttygen to the authorized_keys file.
Now I'm trying to connect to the same machine, but this time from another Ubuntu machine. I have to use the same private key (for a weird reason, don't ask..) and I don't quite get how to install it on my client Ubuntu.
Do I have to convert it to some other format?
ssh
I set up my linux server to accept connections from my home PC by adding the public key generated by puttygen to the authorized_keys file.
Now I'm trying to connect to the same machine, but this time from another Ubuntu machine. I have to use the same private key (for a weird reason, don't ask..) and I don't quite get how to install it on my client Ubuntu.
Do I have to convert it to some other format?
ssh
ssh
edited Nov 29 '10 at 16:21
theTuxRacer
7,167145987
7,167145987
asked Nov 29 '10 at 15:12
![](https://i.stack.imgur.com/jkSDT.jpg?s=32&g=1)
![](https://i.stack.imgur.com/jkSDT.jpg?s=32&g=1)
Assaf Lavie
78331013
78331013
add a comment |Â
add a comment |Â
7 Answers
7
active
oldest
votes
up vote
23
down vote
accepted
I am not sure if your private key will work in ubuntu, but its worth a shot. just copy the keys to /home/yourName/.ssh/
name the private key as id_rsa
, and the public key as id_rsa.pub
.
If that is not working, then you can create you own ssh key-pair using ssh-keygen
and copy the new public key to the server, and ssh as follows
ssh -i ~/.ssh/id_rsa_ubuntu.pub <hostName>
I haven't played with it, but I hear that ssh-agent can also be used to manage ssh-keys.
3
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
3
This answer completely lacks information, how do you get theid_rsa
file (by converting the key in PuTTYgen)
â Martin Prikryl
Feb 12 '15 at 12:15
add a comment |Â
up vote
34
down vote
By coincidence, I just had to do this. You do need to convert the keys to OpenSSH format. The command for doing that is:
ssh-keygen -i -f puttygen_key > openssh_key
then you can copy the contents of openssh_key
in to .ssh/authorized_keys
just as with a normal SSH key.
The -i
option is the one that tells ssh-keygen
to do the conversion. The -f
option tells it where to find the key to convert.
This works for unencrypted keys. The public key is unencrypted, but the private one is probably encrypted. I'm not sure if it there's a way to unencrypt the private key, convert it, and then recrypt it. It may well be easier to use new keys as the other answer suggests (and I'd recommend using ssh-agent
though that's orthogonal to the current issue).
1
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
1
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
tried that, didn't worked (erroruudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)
â Ãdouard Lopez
Mar 2 '17 at 10:04
add a comment |Â
up vote
24
down vote
Andrew Stacey explained how to convert the keys to OpenSSH format on Linux.
If you want to do the same on Windows, follow these steps:
- Start PuTTYGen.
- Click on "Load".
- Select your private key and enter the passphrase.
- From the 'Conversions' menu, select "Export OpenSSH key".
- Choose destination filename.
1
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
add a comment |Â
up vote
21
down vote
How to re-use your Putty key pairs in Ubuntu as OpenSSH keys:
apt-get install putty-tools #Install Putty tools in Linux
cd /my-putty-keys
puttygen mykey-sec.ppk âÂÂO privateâÂÂopenssh âÂÂo myâÂÂopensshâÂÂkey.sec
ssh-keygen -i -f mykey-pub.ppk > my-openssh-key.pub
Since purpose of step 4 is to add your public key to *~./ssh/authorized_keys*, so you can use your Putty secret key like this instead of doing 4 as an intermediate step:
puttygen âÂÂL mykey-sec.ppk >> $HOME/.ssh/authorized_keys
1
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
1
Naming a public key (presumably in RFC 4716 format)mykey-pub.ppk
is pretty confusing, as.ppk
file has a completely different format and is used for key pairs (not just public key).
â Martin Prikryl
Feb 12 '15 at 12:17
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
add a comment |Â
up vote
6
down vote
PuTTY/PuTTYgen uses its own proprietary format of key pair. It won't work on Linux, where OpenSSH format of keys prevails.
In PuTTYgen, you can directly see (and copy + paste) a public key in the format used by the OpenSSH
authorized_keys
file.You can use the button Save public key to save the public key in the
.pub
format (RFC 4716). On Linux the file is typically namedid_rsa.pub
(orid_dsa.pub
). But that's typically not needed.Use the Conversions > Export OpenSSH key to export the private key in the OpenSSH format. On Linux the file is typically named
id_rsa
(orid_dsa
) and is stored in.ssh
folder.
See the official Using PuTTYgen, the PuTTY key generator.
You can also use a Linux version of PuTTYgen to do the conversion. Linux version is command-line, contrary to Windows version.
puttygen mykey.ppk âÂÂO privateâÂÂopenssh âÂÂo id_rsa
See Linux puttygen
man page.
add a comment |Â
up vote
1
down vote
** Be careful and make sure you have console access to the box because if you don't do it right, you won't be able to ssh in again until you fix it from the console.
The process is much easier than you think. Load the public / private key pair you generated in puttygen again. In puttygen, you'll notice a window in the middle of the screen which says: "Public key for pasting into Open SSH authorized_keys file:".
highlight the entire contents of the box and press control-c to copy it.
SSH into your linux box and paste it into the "/home/username/.ssh/authorized_keys" file. I prefer to use nano and just right click to paste it in. Make sure it all stays on one line.
Modify your /etc/sshd_config file as needed and restart your sshd service: "service ssh restart"
If you need a sample sshd_config file, let me know and I can post mine.
I've done this on Ubuntu 8.04, 10.04 and 12.04 LTS server and it works slick.
add a comment |Â
up vote
1
down vote
I found one more clear solution.
On puttygen
create a key, then navigate to Top menu - Conversion and click export openssh key
File content will start and end with
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
for root user Copy that key file to
/root/.ssh/
asid_rsa
orid_dsa
for other user Copy that key file to
/home/user/.ssh/
asid_rsa
orid_dsa
Note :
- No need to edit
authorized_keys
. - I am using amazon linux
- File permission 0600
add a comment |Â
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
23
down vote
accepted
I am not sure if your private key will work in ubuntu, but its worth a shot. just copy the keys to /home/yourName/.ssh/
name the private key as id_rsa
, and the public key as id_rsa.pub
.
If that is not working, then you can create you own ssh key-pair using ssh-keygen
and copy the new public key to the server, and ssh as follows
ssh -i ~/.ssh/id_rsa_ubuntu.pub <hostName>
I haven't played with it, but I hear that ssh-agent can also be used to manage ssh-keys.
3
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
3
This answer completely lacks information, how do you get theid_rsa
file (by converting the key in PuTTYgen)
â Martin Prikryl
Feb 12 '15 at 12:15
add a comment |Â
up vote
23
down vote
accepted
I am not sure if your private key will work in ubuntu, but its worth a shot. just copy the keys to /home/yourName/.ssh/
name the private key as id_rsa
, and the public key as id_rsa.pub
.
If that is not working, then you can create you own ssh key-pair using ssh-keygen
and copy the new public key to the server, and ssh as follows
ssh -i ~/.ssh/id_rsa_ubuntu.pub <hostName>
I haven't played with it, but I hear that ssh-agent can also be used to manage ssh-keys.
3
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
3
This answer completely lacks information, how do you get theid_rsa
file (by converting the key in PuTTYgen)
â Martin Prikryl
Feb 12 '15 at 12:15
add a comment |Â
up vote
23
down vote
accepted
up vote
23
down vote
accepted
I am not sure if your private key will work in ubuntu, but its worth a shot. just copy the keys to /home/yourName/.ssh/
name the private key as id_rsa
, and the public key as id_rsa.pub
.
If that is not working, then you can create you own ssh key-pair using ssh-keygen
and copy the new public key to the server, and ssh as follows
ssh -i ~/.ssh/id_rsa_ubuntu.pub <hostName>
I haven't played with it, but I hear that ssh-agent can also be used to manage ssh-keys.
I am not sure if your private key will work in ubuntu, but its worth a shot. just copy the keys to /home/yourName/.ssh/
name the private key as id_rsa
, and the public key as id_rsa.pub
.
If that is not working, then you can create you own ssh key-pair using ssh-keygen
and copy the new public key to the server, and ssh as follows
ssh -i ~/.ssh/id_rsa_ubuntu.pub <hostName>
I haven't played with it, but I hear that ssh-agent can also be used to manage ssh-keys.
edited Nov 4 '14 at 14:36
Oliâ¦
215k84544752
215k84544752
answered Nov 29 '10 at 16:18
theTuxRacer
7,167145987
7,167145987
3
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
3
This answer completely lacks information, how do you get theid_rsa
file (by converting the key in PuTTYgen)
â Martin Prikryl
Feb 12 '15 at 12:15
add a comment |Â
3
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
3
This answer completely lacks information, how do you get theid_rsa
file (by converting the key in PuTTYgen)
â Martin Prikryl
Feb 12 '15 at 12:15
3
3
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
This does work in ubuntu. However, make sure to not over-write an existing id_rsa key if you already have one (by copying the new key on top of it) unless you know you don't use the old one.
â David Oneill
Nov 29 '10 at 17:35
3
3
This answer completely lacks information, how do you get the
id_rsa
file (by converting the key in PuTTYgen)â Martin Prikryl
Feb 12 '15 at 12:15
This answer completely lacks information, how do you get the
id_rsa
file (by converting the key in PuTTYgen)â Martin Prikryl
Feb 12 '15 at 12:15
add a comment |Â
up vote
34
down vote
By coincidence, I just had to do this. You do need to convert the keys to OpenSSH format. The command for doing that is:
ssh-keygen -i -f puttygen_key > openssh_key
then you can copy the contents of openssh_key
in to .ssh/authorized_keys
just as with a normal SSH key.
The -i
option is the one that tells ssh-keygen
to do the conversion. The -f
option tells it where to find the key to convert.
This works for unencrypted keys. The public key is unencrypted, but the private one is probably encrypted. I'm not sure if it there's a way to unencrypt the private key, convert it, and then recrypt it. It may well be easier to use new keys as the other answer suggests (and I'd recommend using ssh-agent
though that's orthogonal to the current issue).
1
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
1
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
tried that, didn't worked (erroruudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)
â Ãdouard Lopez
Mar 2 '17 at 10:04
add a comment |Â
up vote
34
down vote
By coincidence, I just had to do this. You do need to convert the keys to OpenSSH format. The command for doing that is:
ssh-keygen -i -f puttygen_key > openssh_key
then you can copy the contents of openssh_key
in to .ssh/authorized_keys
just as with a normal SSH key.
The -i
option is the one that tells ssh-keygen
to do the conversion. The -f
option tells it where to find the key to convert.
This works for unencrypted keys. The public key is unencrypted, but the private one is probably encrypted. I'm not sure if it there's a way to unencrypt the private key, convert it, and then recrypt it. It may well be easier to use new keys as the other answer suggests (and I'd recommend using ssh-agent
though that's orthogonal to the current issue).
1
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
1
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
tried that, didn't worked (erroruudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)
â Ãdouard Lopez
Mar 2 '17 at 10:04
add a comment |Â
up vote
34
down vote
up vote
34
down vote
By coincidence, I just had to do this. You do need to convert the keys to OpenSSH format. The command for doing that is:
ssh-keygen -i -f puttygen_key > openssh_key
then you can copy the contents of openssh_key
in to .ssh/authorized_keys
just as with a normal SSH key.
The -i
option is the one that tells ssh-keygen
to do the conversion. The -f
option tells it where to find the key to convert.
This works for unencrypted keys. The public key is unencrypted, but the private one is probably encrypted. I'm not sure if it there's a way to unencrypt the private key, convert it, and then recrypt it. It may well be easier to use new keys as the other answer suggests (and I'd recommend using ssh-agent
though that's orthogonal to the current issue).
By coincidence, I just had to do this. You do need to convert the keys to OpenSSH format. The command for doing that is:
ssh-keygen -i -f puttygen_key > openssh_key
then you can copy the contents of openssh_key
in to .ssh/authorized_keys
just as with a normal SSH key.
The -i
option is the one that tells ssh-keygen
to do the conversion. The -f
option tells it where to find the key to convert.
This works for unencrypted keys. The public key is unencrypted, but the private one is probably encrypted. I'm not sure if it there's a way to unencrypt the private key, convert it, and then recrypt it. It may well be easier to use new keys as the other answer suggests (and I'd recommend using ssh-agent
though that's orthogonal to the current issue).
answered Nov 29 '10 at 20:25
![](https://i.stack.imgur.com/gscG6.png?s=32&g=1)
![](https://i.stack.imgur.com/gscG6.png?s=32&g=1)
Loop Space
44134
44134
1
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
1
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
tried that, didn't worked (erroruudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)
â Ãdouard Lopez
Mar 2 '17 at 10:04
add a comment |Â
1
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
1
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
tried that, didn't worked (erroruudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)
â Ãdouard Lopez
Mar 2 '17 at 10:04
1
1
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
This answer solves my problem. I had to convert the key. Thanks
â leticia
Feb 4 '14 at 0:47
1
1
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
This only solves part of the problem by converting the public key. I used @user18617 's answer to convert the private key as well.
â á´ ÃªÃ´á´Âá´Âôá´Â
Jul 31 '14 at 12:43
tried that, didn't worked (error
uudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)â Ãdouard Lopez
Mar 2 '17 at 10:04
tried that, didn't worked (error
uudecode failed
), need to follows How to convert SSH keypairs generated using PuttyGen(Windows) into key-pairs used by ssh-agent and KeyChain(Linux)â Ãdouard Lopez
Mar 2 '17 at 10:04
add a comment |Â
up vote
24
down vote
Andrew Stacey explained how to convert the keys to OpenSSH format on Linux.
If you want to do the same on Windows, follow these steps:
- Start PuTTYGen.
- Click on "Load".
- Select your private key and enter the passphrase.
- From the 'Conversions' menu, select "Export OpenSSH key".
- Choose destination filename.
1
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
add a comment |Â
up vote
24
down vote
Andrew Stacey explained how to convert the keys to OpenSSH format on Linux.
If you want to do the same on Windows, follow these steps:
- Start PuTTYGen.
- Click on "Load".
- Select your private key and enter the passphrase.
- From the 'Conversions' menu, select "Export OpenSSH key".
- Choose destination filename.
1
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
add a comment |Â
up vote
24
down vote
up vote
24
down vote
Andrew Stacey explained how to convert the keys to OpenSSH format on Linux.
If you want to do the same on Windows, follow these steps:
- Start PuTTYGen.
- Click on "Load".
- Select your private key and enter the passphrase.
- From the 'Conversions' menu, select "Export OpenSSH key".
- Choose destination filename.
Andrew Stacey explained how to convert the keys to OpenSSH format on Linux.
If you want to do the same on Windows, follow these steps:
- Start PuTTYGen.
- Click on "Load".
- Select your private key and enter the passphrase.
- From the 'Conversions' menu, select "Export OpenSSH key".
- Choose destination filename.
edited Apr 13 '17 at 12:23
Communityâ¦
1
1
answered Dec 9 '10 at 22:53
hheimbuerger
4301410
4301410
1
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
add a comment |Â
1
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
1
1
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
I just wanted to say that this worked for me on my Mac OS X, even though I know this is an Ubuntu section. I converted my generated private key in Windows as described above, then copied it in my mac to ~/.ssh/id_rsa. chmod id_rsa 600 to keep Mac from complaining about it.
â Richard
Jul 1 '14 at 14:16
add a comment |Â
up vote
21
down vote
How to re-use your Putty key pairs in Ubuntu as OpenSSH keys:
apt-get install putty-tools #Install Putty tools in Linux
cd /my-putty-keys
puttygen mykey-sec.ppk âÂÂO privateâÂÂopenssh âÂÂo myâÂÂopensshâÂÂkey.sec
ssh-keygen -i -f mykey-pub.ppk > my-openssh-key.pub
Since purpose of step 4 is to add your public key to *~./ssh/authorized_keys*, so you can use your Putty secret key like this instead of doing 4 as an intermediate step:
puttygen âÂÂL mykey-sec.ppk >> $HOME/.ssh/authorized_keys
1
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
1
Naming a public key (presumably in RFC 4716 format)mykey-pub.ppk
is pretty confusing, as.ppk
file has a completely different format and is used for key pairs (not just public key).
â Martin Prikryl
Feb 12 '15 at 12:17
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
add a comment |Â
up vote
21
down vote
How to re-use your Putty key pairs in Ubuntu as OpenSSH keys:
apt-get install putty-tools #Install Putty tools in Linux
cd /my-putty-keys
puttygen mykey-sec.ppk âÂÂO privateâÂÂopenssh âÂÂo myâÂÂopensshâÂÂkey.sec
ssh-keygen -i -f mykey-pub.ppk > my-openssh-key.pub
Since purpose of step 4 is to add your public key to *~./ssh/authorized_keys*, so you can use your Putty secret key like this instead of doing 4 as an intermediate step:
puttygen âÂÂL mykey-sec.ppk >> $HOME/.ssh/authorized_keys
1
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
1
Naming a public key (presumably in RFC 4716 format)mykey-pub.ppk
is pretty confusing, as.ppk
file has a completely different format and is used for key pairs (not just public key).
â Martin Prikryl
Feb 12 '15 at 12:17
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
add a comment |Â
up vote
21
down vote
up vote
21
down vote
How to re-use your Putty key pairs in Ubuntu as OpenSSH keys:
apt-get install putty-tools #Install Putty tools in Linux
cd /my-putty-keys
puttygen mykey-sec.ppk âÂÂO privateâÂÂopenssh âÂÂo myâÂÂopensshâÂÂkey.sec
ssh-keygen -i -f mykey-pub.ppk > my-openssh-key.pub
Since purpose of step 4 is to add your public key to *~./ssh/authorized_keys*, so you can use your Putty secret key like this instead of doing 4 as an intermediate step:
puttygen âÂÂL mykey-sec.ppk >> $HOME/.ssh/authorized_keys
How to re-use your Putty key pairs in Ubuntu as OpenSSH keys:
apt-get install putty-tools #Install Putty tools in Linux
cd /my-putty-keys
puttygen mykey-sec.ppk âÂÂO privateâÂÂopenssh âÂÂo myâÂÂopensshâÂÂkey.sec
ssh-keygen -i -f mykey-pub.ppk > my-openssh-key.pub
Since purpose of step 4 is to add your public key to *~./ssh/authorized_keys*, so you can use your Putty secret key like this instead of doing 4 as an intermediate step:
puttygen âÂÂL mykey-sec.ppk >> $HOME/.ssh/authorized_keys
edited Feb 17 '12 at 16:43
![](https://i.stack.imgur.com/LhR49.png?s=32&g=1)
![](https://i.stack.imgur.com/LhR49.png?s=32&g=1)
Octavian Damiean
11.7k74760
11.7k74760
answered May 26 '11 at 7:32
user18617
21122
21122
1
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
1
Naming a public key (presumably in RFC 4716 format)mykey-pub.ppk
is pretty confusing, as.ppk
file has a completely different format and is used for key pairs (not just public key).
â Martin Prikryl
Feb 12 '15 at 12:17
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
add a comment |Â
1
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
1
Naming a public key (presumably in RFC 4716 format)mykey-pub.ppk
is pretty confusing, as.ppk
file has a completely different format and is used for key pairs (not just public key).
â Martin Prikryl
Feb 12 '15 at 12:17
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
1
1
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
about step 4: if the private key name was mykey-sec.ppk, the source file name in this case would usually be mykey-sec.pub.
â Kinjal Dixit
Sep 4 '11 at 4:56
1
1
Naming a public key (presumably in RFC 4716 format)
mykey-pub.ppk
is pretty confusing, as .ppk
file has a completely different format and is used for key pairs (not just public key).â Martin Prikryl
Feb 12 '15 at 12:17
Naming a public key (presumably in RFC 4716 format)
mykey-pub.ppk
is pretty confusing, as .ppk
file has a completely different format and is used for key pairs (not just public key).â Martin Prikryl
Feb 12 '15 at 12:17
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
That last puttygen line worked perfectly for me after installing putty-tools on debian 9. The other lines and answers in here didn't work.
â Tim
Apr 10 at 4:55
add a comment |Â
up vote
6
down vote
PuTTY/PuTTYgen uses its own proprietary format of key pair. It won't work on Linux, where OpenSSH format of keys prevails.
In PuTTYgen, you can directly see (and copy + paste) a public key in the format used by the OpenSSH
authorized_keys
file.You can use the button Save public key to save the public key in the
.pub
format (RFC 4716). On Linux the file is typically namedid_rsa.pub
(orid_dsa.pub
). But that's typically not needed.Use the Conversions > Export OpenSSH key to export the private key in the OpenSSH format. On Linux the file is typically named
id_rsa
(orid_dsa
) and is stored in.ssh
folder.
See the official Using PuTTYgen, the PuTTY key generator.
You can also use a Linux version of PuTTYgen to do the conversion. Linux version is command-line, contrary to Windows version.
puttygen mykey.ppk âÂÂO privateâÂÂopenssh âÂÂo id_rsa
See Linux puttygen
man page.
add a comment |Â
up vote
6
down vote
PuTTY/PuTTYgen uses its own proprietary format of key pair. It won't work on Linux, where OpenSSH format of keys prevails.
In PuTTYgen, you can directly see (and copy + paste) a public key in the format used by the OpenSSH
authorized_keys
file.You can use the button Save public key to save the public key in the
.pub
format (RFC 4716). On Linux the file is typically namedid_rsa.pub
(orid_dsa.pub
). But that's typically not needed.Use the Conversions > Export OpenSSH key to export the private key in the OpenSSH format. On Linux the file is typically named
id_rsa
(orid_dsa
) and is stored in.ssh
folder.
See the official Using PuTTYgen, the PuTTY key generator.
You can also use a Linux version of PuTTYgen to do the conversion. Linux version is command-line, contrary to Windows version.
puttygen mykey.ppk âÂÂO privateâÂÂopenssh âÂÂo id_rsa
See Linux puttygen
man page.
add a comment |Â
up vote
6
down vote
up vote
6
down vote
PuTTY/PuTTYgen uses its own proprietary format of key pair. It won't work on Linux, where OpenSSH format of keys prevails.
In PuTTYgen, you can directly see (and copy + paste) a public key in the format used by the OpenSSH
authorized_keys
file.You can use the button Save public key to save the public key in the
.pub
format (RFC 4716). On Linux the file is typically namedid_rsa.pub
(orid_dsa.pub
). But that's typically not needed.Use the Conversions > Export OpenSSH key to export the private key in the OpenSSH format. On Linux the file is typically named
id_rsa
(orid_dsa
) and is stored in.ssh
folder.
See the official Using PuTTYgen, the PuTTY key generator.
You can also use a Linux version of PuTTYgen to do the conversion. Linux version is command-line, contrary to Windows version.
puttygen mykey.ppk âÂÂO privateâÂÂopenssh âÂÂo id_rsa
See Linux puttygen
man page.
PuTTY/PuTTYgen uses its own proprietary format of key pair. It won't work on Linux, where OpenSSH format of keys prevails.
In PuTTYgen, you can directly see (and copy + paste) a public key in the format used by the OpenSSH
authorized_keys
file.You can use the button Save public key to save the public key in the
.pub
format (RFC 4716). On Linux the file is typically namedid_rsa.pub
(orid_dsa.pub
). But that's typically not needed.Use the Conversions > Export OpenSSH key to export the private key in the OpenSSH format. On Linux the file is typically named
id_rsa
(orid_dsa
) and is stored in.ssh
folder.
See the official Using PuTTYgen, the PuTTY key generator.
You can also use a Linux version of PuTTYgen to do the conversion. Linux version is command-line, contrary to Windows version.
puttygen mykey.ppk âÂÂO privateâÂÂopenssh âÂÂo id_rsa
See Linux puttygen
man page.
edited Mar 6 '17 at 9:28
answered Feb 12 '15 at 12:14
Martin Prikryl
19219
19219
add a comment |Â
add a comment |Â
up vote
1
down vote
** Be careful and make sure you have console access to the box because if you don't do it right, you won't be able to ssh in again until you fix it from the console.
The process is much easier than you think. Load the public / private key pair you generated in puttygen again. In puttygen, you'll notice a window in the middle of the screen which says: "Public key for pasting into Open SSH authorized_keys file:".
highlight the entire contents of the box and press control-c to copy it.
SSH into your linux box and paste it into the "/home/username/.ssh/authorized_keys" file. I prefer to use nano and just right click to paste it in. Make sure it all stays on one line.
Modify your /etc/sshd_config file as needed and restart your sshd service: "service ssh restart"
If you need a sample sshd_config file, let me know and I can post mine.
I've done this on Ubuntu 8.04, 10.04 and 12.04 LTS server and it works slick.
add a comment |Â
up vote
1
down vote
** Be careful and make sure you have console access to the box because if you don't do it right, you won't be able to ssh in again until you fix it from the console.
The process is much easier than you think. Load the public / private key pair you generated in puttygen again. In puttygen, you'll notice a window in the middle of the screen which says: "Public key for pasting into Open SSH authorized_keys file:".
highlight the entire contents of the box and press control-c to copy it.
SSH into your linux box and paste it into the "/home/username/.ssh/authorized_keys" file. I prefer to use nano and just right click to paste it in. Make sure it all stays on one line.
Modify your /etc/sshd_config file as needed and restart your sshd service: "service ssh restart"
If you need a sample sshd_config file, let me know and I can post mine.
I've done this on Ubuntu 8.04, 10.04 and 12.04 LTS server and it works slick.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
** Be careful and make sure you have console access to the box because if you don't do it right, you won't be able to ssh in again until you fix it from the console.
The process is much easier than you think. Load the public / private key pair you generated in puttygen again. In puttygen, you'll notice a window in the middle of the screen which says: "Public key for pasting into Open SSH authorized_keys file:".
highlight the entire contents of the box and press control-c to copy it.
SSH into your linux box and paste it into the "/home/username/.ssh/authorized_keys" file. I prefer to use nano and just right click to paste it in. Make sure it all stays on one line.
Modify your /etc/sshd_config file as needed and restart your sshd service: "service ssh restart"
If you need a sample sshd_config file, let me know and I can post mine.
I've done this on Ubuntu 8.04, 10.04 and 12.04 LTS server and it works slick.
** Be careful and make sure you have console access to the box because if you don't do it right, you won't be able to ssh in again until you fix it from the console.
The process is much easier than you think. Load the public / private key pair you generated in puttygen again. In puttygen, you'll notice a window in the middle of the screen which says: "Public key for pasting into Open SSH authorized_keys file:".
highlight the entire contents of the box and press control-c to copy it.
SSH into your linux box and paste it into the "/home/username/.ssh/authorized_keys" file. I prefer to use nano and just right click to paste it in. Make sure it all stays on one line.
Modify your /etc/sshd_config file as needed and restart your sshd service: "service ssh restart"
If you need a sample sshd_config file, let me know and I can post mine.
I've done this on Ubuntu 8.04, 10.04 and 12.04 LTS server and it works slick.
answered Feb 22 '13 at 3:58
ErnestA
111
111
add a comment |Â
add a comment |Â
up vote
1
down vote
I found one more clear solution.
On puttygen
create a key, then navigate to Top menu - Conversion and click export openssh key
File content will start and end with
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
for root user Copy that key file to
/root/.ssh/
asid_rsa
orid_dsa
for other user Copy that key file to
/home/user/.ssh/
asid_rsa
orid_dsa
Note :
- No need to edit
authorized_keys
. - I am using amazon linux
- File permission 0600
add a comment |Â
up vote
1
down vote
I found one more clear solution.
On puttygen
create a key, then navigate to Top menu - Conversion and click export openssh key
File content will start and end with
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
for root user Copy that key file to
/root/.ssh/
asid_rsa
orid_dsa
for other user Copy that key file to
/home/user/.ssh/
asid_rsa
orid_dsa
Note :
- No need to edit
authorized_keys
. - I am using amazon linux
- File permission 0600
add a comment |Â
up vote
1
down vote
up vote
1
down vote
I found one more clear solution.
On puttygen
create a key, then navigate to Top menu - Conversion and click export openssh key
File content will start and end with
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
for root user Copy that key file to
/root/.ssh/
asid_rsa
orid_dsa
for other user Copy that key file to
/home/user/.ssh/
asid_rsa
orid_dsa
Note :
- No need to edit
authorized_keys
. - I am using amazon linux
- File permission 0600
I found one more clear solution.
On puttygen
create a key, then navigate to Top menu - Conversion and click export openssh key
File content will start and end with
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
for root user Copy that key file to
/root/.ssh/
asid_rsa
orid_dsa
for other user Copy that key file to
/home/user/.ssh/
asid_rsa
orid_dsa
Note :
- No need to edit
authorized_keys
. - I am using amazon linux
- File permission 0600
edited Dec 7 '16 at 8:32
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
![](https://i.stack.imgur.com/8CW8e.png?s=32&g=1)
Zanna
48.1k13119228
48.1k13119228
answered Dec 7 '16 at 6:12
P-Kumar
111
111
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f15378%2fhow-do-i-install-a-ssh-private-key-generated-by-puttygen%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password