Generating a public-private key pair for password-less authentication
Secure shell (SSH) is often used to log on from one system to another without requiring passwords.
One of the methods used for password-less authentication is to generate a personal set of public-private key pair that uses two keys – a public key known to everyone and a private or secret key known only to the recipient of the message. For example, when John wants to send a secure message to Jack, he uses Jack's public key to encrypt the message. Jack then uses his private key to decrypt it.
An important element to the public key system is that the public and private keys are related in such a way that only the public key can be used to encrypt messages and only the corresponding private key can be used to decrypt them. Moreover, it is virtually impossible to deduce the private key if you know the public key.
Generating a public-private key pair
- Using an SSH client such as PuTTY connect to the computer on which the grid is installed.
- Type ssh-keygen -t rsa -b 1024.
- Accept ~/.ssh/id_rsa, the default file in which to save the private key.
- Press Enter to leave the passphrase empty.
Leaving the passphrase empty, prompts you for the passphrase whenever you attempt to log on to computers that are configured with your public key.
Using a key pair generated on one computer to connect to a different remote target
- On the computer on which the key pair is generated, type cd ~/.ssh.
Type cat id_rsa.pub to list the public key file.
- Copy the contents of the id_rsa.pub file.
- Type ssh <userName>@<computerName> or ssh <userName>@<IPAddress>
<computerName> or <IPAddress> specifies the host name or IP address of the remote target on which to start a secure session. - Specify the password.
- (Optional) If .ssh is not present, type mkdir .ssh.
- Type cd .ssh.
- Type vi authorized_keys.
- Type i to switch to the Insert mode and then, paste the public key copied in step 3.
- Save the authorized_keys file.
- Type exit to return to the computer on which the key pair is generated.
To verify the preceding procedure, type ssh <userName>@<computerName> or ssh <userName>@<IPAddress>, you should not be prompted for the password.
Using a key pair on the same remote target on which it is generated
- On the remote target on which the key pair is generated, type cd ~/.ssh.
Type cat id_rsa.pub to list the public key file.
- Copy the contents of the id_rsa.pub file.
- Type vi authorized_keys.
- Type i to switch to the Insert mode and then, paste the public key copied in step 3.
- Save the authorized_keys file.
To use the private key at the adapter request or configuration level, open the id_rsa file, copy its contents, and then use this private key.