# START ====== configure root auth from client till server
# start from the client $ssh_user@$ssh_client [~] $
export ssh_user="the_user"
export ssh_server="the_ssh_server"
# START === how-to implement public private key ( pkk ) authentication
# create pub priv keys on server
# START copy on the client
test -f ~/.ssh/authorized_keys || ssh-keygen -t rsa
# copy the rsa pub key to the ssh server
scp ~/.ssh/id_rsa.pub $ssh_user@$ssh_server:/home/$ssh_user/
# to to the server
ssh $ssh_user@$ssh_server
# STOP copy on the client
# START copy on the server
test -f ~/.ssh/authorized_keys || ssh-keygen -t rsa
#Hist enter twice if prompted to
cat id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/authorized_keys
chmod -v 0700 ~/.ssh
chmod -v 0600 ~/.ssh/authorized_keys
chmod -v 0600 ~/.ssh/id_rsa
chmod -v 0644 ~/.ssh/id_rsa.pub
find ~/.ssh -exec stat -c "%U:%G %a %n" {} \;
rm -fv ~/id_rsa.pub
exit
# and verify
ssh $ssh_user@$ssh_server
exit
# STOP COPY
# START copy
# on the client
test -f ~/.ssh/authorized_keys2 || echo ssh-keygen -t dsa
# Hit enter twice if prompted to ...
scp ~/.ssh/id_dsa.pub $ssh_user@$ssh_server:/home/$ssh_user/
ssh $ssh_user@$ssh_server
# START copy on the server
test -f ~/.ssh/authorized_keys2 || ssh-keygen -t dsa
# hit enter twice if prompted to
scp ~/.ssh/id_dsa.pub $ssh_user@$ssh_server:/home/$ssh_user/
cat id_dsa.pub >> ~/.ssh/authorized_keys2
cat ~/.ssh/authorized_keys2
chmod -v 0700 ~/.ssh
chmod -v 0600 ~/.ssh/authorized_keys2
chmod -v 0600 ~/.ssh/id_dsa
chmod -v 0644 ~/.ssh/id_dsa.pub
find ~/.ssh -exec stat -c "%U:%G %a %n" {} \;
rm -fv ~/id_dsa.pub
exit
# and verify
ssh $ssh_user@$ssh_server
exit
# STOP COPY
# STOP === how-to implement public private key authentication
# STOP ====== configure root auth from ssh_client till ssh_server
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!