deploymate / app /templates /ssh_key_setup.j2
shakauthossain's picture
Version 1.0.0
4e9eb6a
raw
history blame contribute delete
382 Bytes
#!/bin/bash
# SSH key setup script
# Generate SSH key pair
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
# Copy public key to authorized_keys
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
# Disable password authentication
sudo sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo systemctl restart sshd