Enter the command ssh-copy-id alpha@Slv1
; alpha
is the username that will receive the key, and Slv1
is the host which it belongs to. Enter the password for Slv1
(see the highlighted commands in the following screenshot):
Oops! Entered the incorrect password. That's it! You have transferred the key. Now ssh
into Slv1
. It's now asking for a passphrase
instead of a password; see the following screenshot. Enter the passphrase
you provided earlier. This is great!
Now ssh
back into Mst0
, and list the files in the alpha
user by entering ls -la
. We can see the .ssh
folder. Go ahead and list the files in the .ssh
folder (see the following screenshot):
We now see the authorized keys id_rsa
, id_rsa.pub
, known_hosts
. Now ssh
into the Slv1
node:
We see that it is asking for a passphrase
. This is not what we are looking for, so we still must make a few changes to our master node. Enter the passphrase
, and enter exit
. You should now have returned to the master node, pi@Mst0:~ $
. If you are not now at the master node, close out the terminal window, and ssh
back into the master node, and proceed; in other words, enter ssh [email protected]
and provide the password. Log into the alpha
user by entering, at the $
prompt, su - alpha
. You should now be at the alpha
user prompt, alpha@Mst0:~ $
. We are now going to edit a file called .bashrc
within our home
directory. Enter vim .bashrc
, and then i
to initiate editing. This opens a large file shown on the next few pages. Go to the bottom of the file and add the highlighted text, and then save the updated file by pressing the
Esc
key and entering :wq
:
The highlighted text is where the keychain
logic that you are going to be using resides. The keychain
component calls the keychain
command located in the keychain
file. The .ssh
component passes in the parameter/path of the location of the ID file id_rsa
. The source $HOME/.keychain/$HOSTNAME-sh
command runs the $HOSTNAME-sh
file. You should now recompile the .bashrc
file. So enter source.bashrc
and provide the passphrase
one more time (see the following highlighted text):
You can enter which keychain
to uncover the path to keychain
.
Go ahead and enter ssh Slv1
:
This time you were not prompted for the passphrase
. Excellent!
3.12.150.250