Ensure OpenSSH is installed on your system:
$ sudo apt update && sudo apt install openssh-client
Run this command to generate your SSH key pair:
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
When prompted, enter a secure passphrase for additional protection.
Add your new SSH key to the SSH-Agent:
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa
Copy your public key to the remote server:
$ ssh-copy-id user@remote_host
Or manually:
$ cat ~/.ssh/id_rsa.pub | ssh user@remote_host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
Test your SSH connection:
$ ssh user@remote_host
Visit LinuxPatch.com for automated patch management and security tools.