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 to the server. Then
cp authorized_keys authorized_keys_Backup
cat >> 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/ >> ~/.ssh/authorized_keys[/pre]

Source1, Source2

You may also interested in reading:

No comments:

Post a Comment