GENWiki

Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


computerfaq:push_ssh_key_to_server

How to push your SSH key to your SSH server

ssh-copy-id is the command for this, we can simply use it thus:

  1. ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 fred@10.1.1.1

Above, we're assuming your private key is in the usual place (~/.ssh/id_rsa.pub) change this if you've put it elsewhere, Port we're using is 22 (the standard port) and the account on the remote server is 'fred' at the server 10.1.1.1

You will probably be prompted for a password, enter it and it will then upload your key.

To enable BOTH Key and Password (recommended) edit your sshd_config file which normally resides in /etc/ssh

Add the line

AuthenticationMethods "publickey,password"

and comment out or remove the line

PasswordAuthentication yes

Then restart sshd (systemctl restart sshd) and test.

Generate Public/Private Key Pair for SSH

If you've come here looking to CREATE a private/public key, then its very simple, just use

  1. ssh-keygen -t rsa

This will (should) create your key pair in your ~/.ssh folder.

/data/webs/external/dokuwiki/data/pages/computerfaq/push_ssh_key_to_server.txt · Last modified: 2022/03/18 19:36 by genadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki