kubernetes-the-hard-way/vagrant/ubuntu/ssh.sh

23 lines
739 B
Bash
Executable File

#!/bin/bash
# Enable password auth in sshd so we can use ssh-copy-id
sed -i --regexp-extended 's/#?PasswordAuthentication (yes|no)/PasswordAuthentication yes/' /etc/ssh/sshd_config
sed -i --regexp-extended 's/#?Include \/etc\/ssh\/sshd_config.d\/\*.conf/#Include \/etc\/ssh\/sshd_config.d\/\*.conf/' /etc/ssh/sshd_config
sed -i 's/KbdInteractiveAuthentication no/KbdInteractiveAuthentication yes/' /etc/ssh/sshd_config
systemctl restart sshd
if [ ! -d /home/vagrant/.ssh ]
then
mkdir /home/vagrant/.ssh
chmod 700 /home/vagrant/.ssh
chown vagrant:vagrant /home/vagrant/.ssh
fi
if [ "$(hostname)" = "controlplane01" ]
then
sh -c 'sudo apt update' &> /dev/null
sh -c 'sudo apt-get install -y sshpass' &> /dev/null
fi