SSH Open Format
When people who are not Unix-based users, they will most probably use the public key format (eg. Putty) which will have to be converted into the open-ssh format .
How To?
The Problem: SSH2-formatted keys
You receive an open-ssh-formatted public key looking like this:
And want to convert it to an ssh key format like this:
Solution: Convert the SSH2-formatted key to Open-SSH
You can do this with a very simple command:
The command above will take the key from the file ssh2.pub and write it to openssh.pub.
If you just want to look at the open-ssh key material, or have it ready for copy and paste, then you don’t have to worry about piping stdout into a file (same command as above, without the last part):
This will simply display the public key in the Open-SSH format.
A more practical example of this might be converting and appending a coworker’s key to a server’s authorized keys file. This can be achieved using the following command:
After this a coworker, using the according private key will be able to log into the system as the user who runs this command.
The Other Direction: Converting SSH2 keys to the Open-SSH Format
The opposite — converting Open-SSH to SSH2 keys — is also possible, of course. Simply use the -e (for export) flag, instead of -i (for import).
Last updated
Was this helpful?