Tuesday, April 30, 2019

Passwordless SSH

https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
-------------------------------------------------------------------------------------------------------

SSH Passwordless Login

Step 1: Create Authentication SSH-Kegen Keys on – (xsnl11c949k)

ssh-keygen -t rsa

Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.

Step 2: Create .ssh Directory on – xsnl11c951b

ssh x007516a@xsnl11c951b mkdir -p .ssh

Step 3: Upload Generated Public Keys to – xsnl11c951b

cat .ssh/id_rsa.pub | ssh x007516a@xsnl11c951b 'cat >> .ssh/authorized_keys'

Step 4: Set Permissions on – xsnl11c951b

ssh x007516a@xsnl11c951b "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

Step 5: Login from xsnl11c949k to xsnl11c951b Server without Password

----------------------------------------------------------------------------------------------------

#!/bin/bash
servers="/home/servers.txt"
for server in `cat $servers`
do
ssh tommy@$server mkdir -p .ssh
cat .ssh/id_rsa.pub | ssh tommy@$server 'cat >> .ssh/authorized_keys'
ssh tommy@$server "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
done

1 comment:

  1. Very impressive article! The blog is highly informative and has answered all my questions.
    To introduce about our company and the activities, Techno Data Group
    is a database provider that helps you to boost your sales & grow your business through well-build
    MongoDB Users Email.

    ReplyDelete