Generating Keys
To generate the public and private key files, you can use ssh-keygen command which is installed with OpenSSH.ssh-keygenBy default, your public key file is located at
~/.ssh/id_rsa.pub
and it can be shared with anyone. Your private key file is located at ~/.ssh/id_rsa
and it must be kept secret. Key Installation
You now need to copy your public key file to the remote host(s) that you want to be able to use public key authentication.1. Copy your public key to remote host1.example.net using one simple command:
ssh-copy-id -i ~/.ssh/id_rsa.pub username@host1.example.net
2. Manual Installation
To install the key manually you need to append the key to the ~/.ssh/authorized_keys file on each host you wish to use.
# copy the key to the remote host scp ~/.ssh/id_rsa.pub user@remotehost:id_rsa.pub # ssh into the remote host using your password ssh user@remotehost # append the public key cat id_rsa.pub >> ~/.ssh/authorized_keys rm id_rsa.pubON WINDOWS You can download puttygen.exe to generate private and public key pairs. Copy public keys generated to your remote host
~/.ssh/authorized_keys
file and make sure they are in ONE LINE.
No comments:
Post a Comment