kelseyhightower / kubernetes-the-hard-way

Bootstrap Kubernetes the hard way. No scripts.
Apache License 2.0
39.77k stars 13.65k forks source link

Facing Issue in Configuring SSH Access #783

Open akshat-kumar2109 opened 1 month ago

akshat-kumar2109 commented 1 month ago

I had to manually add the SSH keys to each servers. I am getting this error on the following command. Can anyone tell me what can be the reason for this?

root@ip-172-31-19-252:~/kubernetes-the-hard-way# while read IP FQDN HOST SUBNET; do    ssh-copy-id root@${IP}; done < machines.txt
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@34.232.210.182: Permission denied (publickey).
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@3.221.163.8: Permission denied (publickey).
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_ed25519.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@3.238.13.255: Permission denied (publickey).
aasourav commented 1 month ago

this works on my local virtual machines. didn't try on cloud.

step 1: sudo vim /etc/ssh/sshd_config step 2: FROM:

PermitRootLogin prohibit-password

    TO:
    PermitRootLogin yes

Shortcut (Step 1 + Step 2): sudo sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config

step 3: sudo systemctl restart ssh

step 4: sudo passwd [sudo] password for linuxconfig: Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully

step 5: sudo ufw allow ssh