How to add RSA key to authorized_keys file?

后端 未结 5 1248
后悔当初
后悔当初 2021-01-29 23:06

I\'ve created an RSA public key and I want to add that to authorized_keys file, but there is no such file in my Ubuntu 11.10 machine.

How can I add the key

5条回答
  •  太阳男子
    2021-01-29 23:46

    There is already a command in the ssh suite to do this automatically for you. I.e log into a remote host and add the public key to that computers authorized_keys file.

    ssh-copy-id -i /path/to/key/file user@host.com
    

    If the key you are installing is ~/.ssh/id_rsa then you can even drop the -i flag completely.

    Much better than manually doing it!

提交回复
热议问题