Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Public key on windows machine to ~/.ssh/authorized_keys format

I am probably being stupid but if a client sends me a public key file which looks like:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20170118"
AAAAd3NzaC1yc2EAAAABJQAAAQEAl3cTBx1TvQDtgyk0Jtgl0FhMCPRGs11/jwGk
q4kFjRqwraqum3SnbXl3ItsqDbPQwcfewHPPBxtMk8LpVQ6tRik481U2x+jkP3Q2
WWnLvvgIlsCrah7s35/Dwgr0h5PyvUnkKhLbeCh0IxFbHfHzwHdrNFUWzfAKsQLR
qu328kpio0W7MLtcw0HfbHdSquAKK6URJV6tsmDHYkO7+3bYhXhw0Sviri8L/Ksp
W6A/1JxVA833GbsbWykP6EZ0AfaTrHSfR/z2MgaL2RqCGbFIpt0Q+KP5NoIGHBOK
F7s8Qefh6oRUthMAGK7Whq78QUHCM5b6pqj/0iJba9EZaa41qQ==
---- END SSH2 PUBLIC KEY ----

What is the best way to get this into the correct format and into an ~/.ssh/authorized_keys format. I always end up having to manually edit it and then cut and paste it to the format.

ssh-rsa AAAAd3NzaC1yc2EAAAABJQAAAQEAl3cTBx1TvQDtgyk0Jtgl0FhMCPR.....

Would be great is there was a command which would allow me to upload it onto the server and would then copy it into the ~/.ssh/authorized_keys and it would put it in the right format.

Any help greatly appreciated.

Comments

  • ssh-keygen -i -f input.pub > output.pub

  • Thank you so much, that just save me a lot of time and pain :-)

  • I hope you're not manually cutting and pasting ;)

    cat output.pub >> ~/.ssh/authorized_keys

  • There is also a ssh-copy-id to copy (and set correct chmods ;)) to authorized_keys file. No idea if there is a windows binary, but happy googling ;-P

  • @Ishaq said:
    I hope you're not manually cutting and pasting ;)

    cat output.pub >> ~/.ssh/authorized_keys

    No already got that part working and have deployed the needed public keys in half the time, thanks for the help

Sign In or Register to comment.