Technical 5 min read October 13, 2026

The Ultimate Guide to SSH: How to Set Up Passwordless Login & Fix Host Key Errors

A
Amit Hasan
The Ultimate Guide to SSH: How to Set Up Passwordless Login & Fix Host Key Errors

If you work with servers, you probably use SSH (Secure Shell) every day. It is the best way to connect to a remote computer. But let's be honest: typing your password every single time you log in is annoying and wastes time.

Even worse is when you try to connect and suddenly see a scary red message saying "Host key verification failed."

In this easy-to-understand guide, we will solve both of these problems. You will learn how to log in securely without a password and how to permanently fix those annoying SSH errors.

Part 1: How to Set Up Passwordless SSH Login

Getting rid of the password step is actually much safer than using a traditional password. To do this, we use "SSH Keys." Think of it as a highly secure digital lock and key. The server holds the lock, and your computer holds the only key that can open it.

Here is how to set it up in three simple steps:

Step 1: Create your digital key

Open your Terminal (on Mac/Linux) or Command Prompt/PowerShell (on Windows). Type the following command and hit Enter:

ssh-keygen -t rsa -b 4096

The computer will ask you a few questions. Just press Enter for all of them to accept the default settings. You do not need to type a passphrase.

Step 2: Send the key to your server

Now, you need to put the digital lock on your server. Type this command (make sure to replace the username and IP address with your actual server details):

ssh-copy-id username@your_server_ip

The server will ask for your password one last time. Type it in, and the key will be saved.

Step 3: Test your new passwordless login

Now for the fun part. Try to log into your server just like you normally do:

ssh username@your_server_ip

Magic! You are logged in immediately. The server will not ask for a password ever again.

Part 2: Fixing SSH Host Key Verification Errors

Sometimes, if a server gets a fresh operating system installed or changes its IP address, your computer gets confused. It will block you from logging in and show a massive warning: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! or Host key verification failed.

This happens because your computer remembers the old server details and thinks someone might be trying to hack you. Here are two easy ways to fix it:

Solution 1: Remove the Old Memory (The Standard Fix)

The safest and most common way to fix this is to tell your computer to forget the old server details. Run this command in your terminal:

ssh-keygen -R your_server_ip

After you do this, try logging in again. It will ask if you want to connect to the new server. Type yes, and you are good to go.

Solution 2: The Permanent Bypass (For Advanced Users)

If you are a developer who works with a lot of temporary test servers, removing old keys every single day is very frustrating. If you want to permanently log in without SSH ever asking you to verify host keys, you can bypass this rule entirely.

Open a file on your computer located at ~/.ssh/config (if the file does not exist, simply create it). Add these exact lines of text into the file and save it:

Host * StrictHostKeyChecking no UserKnownHostsFile=/dev/null

Once you save this, SSH will automatically accept all new servers. You will never see that annoying warning message again! (Quick Note: Only use this trick for development or test servers. It is not recommended for highly sensitive production servers.)

A fast, smooth, and error-free server environment is the secret to building great software quickly. By using passwordless logins and knowing how to bypass annoying host key errors, you can save hours of frustration and focus on what really matters—writing great code.

If you want to modernize your IT infrastructure, speed up your development, or need professional help managing your cloud servers, the expert team at Kovence is always here to help you scale smoothly!

Chat with us!