Connect with a public key

Connect in SSH with a public key (rather than a password) has some benefits: enhanced security, ability to set an "empty" password... Here are the steps to follow to configure a SSH account with public key.

On Windows

Steps are realized with PuTTY, a SSH client available free of charge.

  • Generate the private key:

    • Launch PuTTYGen (provide by PuTTy);
    • Generate a SSH-2 RSA de 1024 bits key pair;
    • Store the private key on your workstation;
  • Declare the key on the server by copying this key on the ~/.ssh/authorized_keys file of your alwaysdata account.

  • Connect in SSH: configure your PuTTY session, in the Auth category, then in Private Key file for auth, load your private key.

On Unix / OS X

  • Generate the private key:

mkdir -p ~/.ssh

chmod 0700 ~/.ssh

ssh-keygen -t rsa -f ~/.ssh/id_rsa

You you want to never have to enter your password to login in SSH, enter an empty "passphrase".

  • Declare the key on the server:

ssh-copy-id -i ~/.ssh/ user@ssh-[accountname]

Replace « user » by the name of your SSH user and « ssh-[accountname] » by your SSH hostname.

You also can manually copy the content of this file in the ~/.ssh/authorized_keys file of your alwaysdata account.

  • Connect in SSH : at the next SSH connection, your passphrase will be asked (or nothing is your passphrase is empty).

Last updated: 30 Nov. 2018 at 14:19