Passwordless Authentication in linux

Krupa Bhimani
2 min readFeb 17, 2022

Hello Readers, today the topic is how to setup passwordless authentication. for that first we need to understand what is passwordless authentication and what is the difference between passwordless authentication and MFA. you will learn everything in this blog. So, Let’s check it out.

passwordless authentication
  • It is a kind of authentication method in which a user can login without a password. User has to complete the authentication process by providing secure proof through a register device.
  • In this method public key and private key would be used to authenticate.
  • Public key: it is a long random stream of bits which is derivative of a private key.
  • Private key: long random stream of bits, kept secret never leaves the client.
  • You can generate the public key from the private key but cannot do the opposite thing.
  • In passwordless authentication, the public key is provided to servers,websites etc. and the private key is in the user’s device.

How is MFA different from passwordless authentication?

  • MFA is an added layer of security on password based authentication.

Steps for passwordless authentication:

Step 1: create ssh keypair from following command:

Ssh -keygen -t rsa

Here -t means type

  • Enter the location where you want to store it. Enter the path.
  • Verify you have successfully created a key pair.

Ls ~/.ssh.id/*

Step 2: upload public key to remote server

  • To enable passwordless access you have to upload a copy of the public key to the server under the .ssh directory as a file name ‘authorized_keys’.

Ssh-copy-id [remote_username]@[server ip add]

Step 3: Login without password

Ssh [remote_username]@[server ip add]

Scenario of passwordless authentication:

scenario

This client has both public and private keys. And the server will have only a public key.

  1. Client ask server to connect
  2. Server acknowledges with encrypted message using public key.
  3. Client decrypts the message using a private key.

Connection established.

This is how it works.

--

--

Krupa Bhimani

2X AWS Certified, DevOps Engineer, Microsoft Learn Student Ambassadors (Alpha)