Source: https://wiki.cdot.senecacollege.ca/wiki/OPS335_Lab_1
Generate key:
$ ssh-keygen
You will have id_rsa.pub and id_rsa
Send id_rsa.pub to server admin or paste into server you need to ssh.
Some reference link
Use SSH Keys with PuTTY on Windows
https://devops.profitbricks.com/tutorials/use-ssh-keys-with-putty-on-windows/
Copy Public Key to Server
The OpenSSH public key is located in the box underKey
/ Public key for pasting info OpenSSH authorized_keys file:
. The public key begins with ssh-rsa followed by a string of characters. - Highlight entire public key within the PuTTY Key Generator and copy the text.
- Launch PuTTY and log into the remote server with your existing user credentials.
-
Use your preferred text editor to create and/or open the
authorized_keys
file:
vi ~/.ssh/authorized_keys
-
Paste the public key into the
authorized_keys
file.
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQBp2eUlwvehXTD3xc7jek3y41n9fO0A+TyLqfd5ZAvuqrwNcR2K7UXPVVkFmTZBes3PNnab4UkbFCki23tP6jLzJx/MufHypXprSYF3x4RFh0ZoGtRkr/J8DBKE8UiZIPUeud0bQOXztvP+pVXT+HfSnLdN62lXTxLUp9EBZhe3Eb/5nwFaKNpFg1r5NLIpREU2H6fIepi9z28rbEjDj71Z+GOKDXqYWacpbzyIzcYVrsFq8uqOIEh7QAkR9H0k4lRhKNlIANyGADCMisGWwmIiPJUIRtWkrQjUOvQgrQjtPcofuxKaWaF5NqwKCc5FDVzsysaL5IM9/gij8837QN7z rsa-key-20141103
-
Save the file and close the text editor.
-
Adjust the permissions of the
authorized_keys
file so that the file does not allow group writable permissions.
chmod 600 ~/.ssh/authorized_keys
-
Logout of the remote server.
Connect to Server with Private Key
Now it is time to test SSH key authentication. The PuTTYgen tool can be closed and PuTTY launched again.- Enter the remote server Host Name or IP address under
Session
. - Navigate to
Connection
>SSH
>Auth
. - Click
Browse...
underAuthentication parameters
/Private key file for authentication
. - Locate the
id_rsa.ppk
private key and clickOpen
. - Finally, click
Open
again to log into the remote server with key pair authentication.
No comments:
Post a Comment