nonameHosts blog
  • Home
  • Services
    • VPS Hosting
    • Shared Hosting
    • Dedicated servers
  • Contacts
  • FAQ

How to setup SSH login without password

  • Apr 15, 2015
  • /
  • Tutorials

You can login to a Linux system without entering a password and here are 3 simple steps to set it up.

Step 1: Generate the authentication key

To generate private and public keys, run this on a local machine:

admin@local$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/admin/.ssh/id_rsa):[Enter key]
Enter passphrase (empty for no passphrase): [Press enter key]
Enter same passphrase again: [Pess enter key]
Your identification has been saved in /home/admin/.ssh/id_rsa.
Your public key has been saved in /home/admin/.ssh/id_rsa.pub.
The key fingerprint is:
33:b3:fe:af:95:95:18:11:31:d5:de:96:2f:f2:35:f9 admin@local

 Step 2: Install the public key on server

SSH usually comes with an utility called ssh-copy-id that simply adds the contents of client’s ~/.ssh/id_rsa.pub to the server’s ~/.ssh/authorized_keys:

admin@local$ ssh-copy-id -i ~/.ssh/id_rsa.pub server
admin@server's password:
Now try logging into the machine, with "ssh 'server'", and check in:

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

In case ssh-copy-id isn’t available, you can use scp or other file transfer method.

Step 3: Access

Now just access the server by typing:

admin@local$ ssh server

You should see something like this:

admin@local$ ssh server
admin@server$

Or this, if you entered the passphrase:

admin@local$ ssh server
Enter passphrase for key '/home/admin/.ssh/id_rsa':
admin@server$

Categories

  • News
  • Readings
  • Security
  • Tutorials

Recent Posts

  • How to install nginx on debian 11
  • Top 10 WordPress hosting provider award
  • Welcome to more resources and cheaper pricing!
  • Stripe payments now available
  • nonameHosts review by WebsitePlanet

Social Icons

© 2018 JSC "Debesynas", all rights reserved.