SSH


Login using ssh key

#make this directory if needed, set permissions and generate keys

mkdir -p ~/.ssh

chmod 700 ~/.ssh

ssh-keygen -t rsa

#copy your public key to the server your trying to connect too

ssh-copy-id -i ~/.ssh/id_rsa.pub user@server

# Or copy manually by pasting the key into the authorized key file on the remote server

sudo nano ~/.ssh/authorized_keys

#optional you can disable password logins

sudo nano /etc/ssh/sshd_config

PasswordAuthentication no

PubkeyAuthentication yes

sudo systemctl restart sshd

------------

Connect using private key

the private key would need to be distributed(this can be quick to setup but is not recommended as you should never really distribute a servers private key!)

copy the public key on the remote server into the authorized into its own authorized key file, then connect to that server using the private key





#random notes

cd ~/.ssh/

/home/donald/.ssh

ssh -i fplabs test.fullproxylabs.com

sudo chmod 600 key

sudo chmod 644 key.pub

sudo nano /etc/ssh/sshd_config

PasswordAuthentication no

PubkeyAuthentication yes

sudo systemctl restart sshd




Ref; https://upcloud.com/community/tutorials/use-ssh-keys-authentication/