#!/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