Key-Based ssh Login

In this post we will look at how to use ssh key-based login.


[pre class="brush:bash"]
ssh-keygen -t rsa

# copy id_rsa.pub to the server. Then
cp authorized_keys authorized_keys_Backup
cat id_rsa.pub >> authorized_keys

# if .ssh or authorized_keys is not available,
#follow the following instructions to create them,
# create the .ssh directory:
mkdir ~/.ssh
# set the right permissions:
chmod 700 ~/.ssh
# create the authorized_keys file:
touch ~/.ssh/authorized_keys

# set the right permissions:
chmod 600 ~/.ssh/authorized_keys

cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys[/pre]

Source1, Source2

You may also interested in reading:

No comments:

Post a Comment