SSH Keys
Requirements
SSH keys explained
SSH keys contain 2 pieces, a public key and a private key.
The public key is installed on whatever hardware you wish to SSH into. The private key is installed on the machine you will SSH from.
How to install the Public Key
Public Keys allow the user with the private key to SSH into the machine
Ubuntu
SSH into the server and run the below command to elevate to Root user, input the password you used to log in
sudo -iRun the below commands
mkdir -p ~/.ssh echo ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhKliloNg32f9J8xtnLi0wal4FVnTYkNNQRhqTdPNcT [email protected] >> ~/.ssh/authorized_keys chmod -R go= ~/.ssh
Windows
Log into the server as an administrator
Open Powershell as administrator and run the below command
echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDhKliloNg32f9J8xtnLi0wal4FVnTYkNNQRhqTdPNcT [email protected]" | Out-File -filepath $ENV:userprofile\.ssh\id_rsa.pub -Force -verbose
How to install the Private Key
The private key is used to SSH into servers configured with the public key
Ubuntu
SSH into the server and SU into the Root account
Run the below commands
mkdir -p ~/.ssh/ nano ~/.ssh/id_rsaIn the text editor, copy and paste the contents of the Private Key and save
Run the below commands to make the key usable
chmod 700 ~/.ssh/ chmod 600 ~/.ssh/id_rsa
Windows
Log into the server as an administrator
Open Powershell and run the below command. You will need to provide the private key stored in Bitwarden
read-host "Please provide the private SSH key" | echo | Out-File -filepath (join-path $ENV:userprofile -childpath .ssh\id_rsa) -Force -verbose
Last updated
Was this helpful?