You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Install SSH server
apt install openssh-server
# Enable SSH server on startup
systemctl enable ssh
# Check SSH server status
systemctl status ssh
# Allow SSH through firewall
ufw allow ssh
# Modify SSH config (optional)
nano /etc/ssh/sshd_config
systemctl restart ssh
Method 1 (SSH Copy)
Client - Generate public/private key pair
# Generate public/private key pair
ssh-keygen -t ed25519 -f <KEY PAIR NAME> -C "<COMMENT>"# Copy public key to server
ssh-copy-id -i <PUBLIC KEY NAME>.pub <USERNAME>@<SERVER ADDRESS># Connect to server
ssh <USERNAME>@<SERVER ADDRESS>
Method 2 (Copy/Paste)
Client - Copy public key to clipboard
# Generate public/private key pair
ssh-keygen -t ed25519 -f <KEY PAIR NAME> -C "<COMMENT>"# Display contents of public key on client. Copy to clipboard.
cat <PUBLIC KEY NAME GOES HERE>.pub
Server - Paste public key into authorized keys file
# Create .ssh directory if not already created
mkdir -p ~/.ssh
# Set permissions of .ssh directory
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# Open authorized keys file in text editor and paste clipboard
nano ~/.ssh/authorized_keys