profile for Gajendra D Ambi on Stack Exchange, a network of free, community-driven Q&A sites

Friday, September 14, 2018

ssh to hosts without credentials

[TLDR]

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sudo su
yum install nano -y
sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/g' /etc/ssh/sshd_config
sudo systemctl restart sshd
ssh-keygen -t rsa

ssh-copy-id -i ~/.ssh/id_rsa.pub root@<hostname or ip address>
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<hostname or ip address>
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<hostname or ip address>
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<hostname or ip address>
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<hostname or ip address>
ssh-copy-id -i ~/.ssh/id_rsa.pub root@<hostname or ip address>

So one of the main requirements for the members of kubernetes clusters is to be able to ssh without credentials.
I tested this against CENTOS 7 virtual machines on
AWS
DigitalOcean.
lines
1.switch to root user
2. install nano -y (optional)
3. enable login with password option
4. restart ssh service.
5. generate an rsa ssh key
7-12. copy the ssh key to the target machines.
[OR]
just copy paste the whole thing on all machines.
Note:- don't enter a passphrase while generating key.