SSH Authentication with public-key

, Add comments

To create the private and public keys type on the unix prompt:

$ ssh-keygen

You can use the default location, and not use a passphrase. The keys will be created in the directory:

/home/<username>/.ssh/

Inside this directory you’ll find two files id_rsa (the private key), and id_rsa.pub (the public key).

Login into the remote server and created the ‘.ssh’ under the home directory. Ensure the directory only has permissions to the owner.

$ ssh <remote username>@<remote hostname>
$ mkdir .ssh
$ chmod 700 .ssh

Go back to your host server and copy the public key to the remote server.

$ sftp <remote username>@<remote hostname>
$ put /home/<username>/.ssh/id_rsa.pub ./ssh

Login into the remote server again and rename the public key to authorized_keys. Also ensure the file only has permissions to the owner.

$ ssh <remote username>@<remote hostname>
$ cd .ssh
$ mv id_rsa.pub authorized_keys
$ chmod 600 authorized_keys

Next time you ssh to the remote server, you should be logged in automatically without needing to enter a password.

Related posts:

  1. Surfing the Web using SSH Tunnel
  2. Remote Desktop with SSH Tunneling
  3. Apache HTTP Authentication
  4. Samba on Ubuntu Quickstart Guide
  5. GnuPGP Quickstart Guide

Comments are closed.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in