How to add RSA key to authorized_keys file?

后端 未结 5 1318
后悔当初
后悔当初 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:57

    I know I am replying too late but for anyone else who needs this, run following command from your local machine

    cat ~/.ssh/id_rsa.pub | ssh user@192.168.1.1 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys"
    

    this has worked perfectly fine. All you need to do is just to replace

    user@192.168.1.1

    with your own user for that particular host

提交回复
热议问题