Fixing the remote host has changed warning message

WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

When you use SSH to login to a remote system, the host’s identification key is stored inside your user’s home folder. If you try to SSH into the remote system again in the future, your computer will check to make sure that you’re logging into the same system as before. Sure, the IP address or hostname might be the same, but maybe a different system has taken over that IP or hostname. If that’s the case, you wouldn’t want to enter your password into the foreign system.

When this is detected, you’ll receive a warning to the effect of WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!. Then again, sometimes a remote host’s keys could have changed for a perfectly legitimate reason. If you know this to be true, then you can ignore the warning.

In this guide, we’ll show you how to bypass the SSH remote host warning, as well as permanently remedy the problem on a Linux system. Read on to see how.

In this tutorial you will learn:

  • How to remove invalid SSH host key from config
Fixing the remote host has changed warning message

Fixing the remote host has changed warning message

Read more

Executing remote commands via SSH

Executing commands remotely with ssh and output redirection

The SSH command can be used to remotely login to a server running an sshd daemon. This allows Linux administrators to perform variety of administrative jobs. However, SSH is more powerful than just providing a user with remote shell access, as it can also be used to automate remote command executions, like running simple backups and downloading the backup file locally.

In this guide, we’ll go over a few different command line examples to show how you can execute commands on a remote system via SSH, as well as direct the output back to your local machine.

In this tutorial you will learn:

  • Examples for remote command execution via SSH

Read more

Configuring SSH login without password between two systems

SSH login without password

If you ever get tired of typing in your SSH password, we’ve got good news. It’s possible to configure public key authentication on Linux systems, which allows you to connect to a server through SSH, without using a password.

The best part is, using key authentication is actually more secure than typing in a password each time. This is in addition to being far more convenient. It also allows you to automate certain tasks, such as rsync scripts or other Bash scripts that utilize SSH, SCP, etc.

The process for setting up key authentication involves generating RSA keys on one system, then copying the key to a remote host. This works on any Linux distribution and is a short and easy process. Follow along with the instructions below as we take you through the step by step guide to configure passwordless SSH on Linux.

In this tutorial you will learn:

  • Generate RSA keys and transfer to remote system
  • How to login with SSH without a password

Read more

Connecting to a running Docker container via SSH on Linux

How to connect to Docker container via ssh

After installing Docker on Fedora, AlmaLinux, Manjaro, or some other distro, it’s time to install more containers. Once you have a Docker container up and running on a Linux system, one of the things you’ll likely need to do is run commands inside the container. This allows you to use the container similarly to how you would a physical machine, except that Docker has done most of the setup legwork for us already.

There are already two commands available that allow us to run commands on a Docker container. The first one is docker exec, and the second command, which allows us to attach to a running container, is docker attach. These commands usually suffice, but you may find yourself in a scenario where you’d prefer to use SSH to connect to the Docker container and manage it.

Not all Docker containers are provisioned to run SSH. Normally, Docker containers are very lightweight and only programmed to do one thing. However, some Docker containers will allow SSH, and this can make management of the container much easier. In this guide, we’ll see how to connect to a Docker container via SSH from the host system on Linux command line.

In this tutorial you will learn:

  • How to connect to a running Docker container via SSH

Read more

Creating an SSH tunnel through port forwarding on Linux

Enable SSH port forwarding on Linux

Most Linux users are familiar with the SSH protocol as it allows remote management of any Linux system. It’s also commonly used for SFTP to download or upload files. SSH is known as a very secure protocol because it encrypts traffic end to end. But the encrypted tunnels it creates are actually quite versatile and can be used for more than just remote server management or file transfer.

SSH port forwarding can be used to encrypt the traffic between two systems for pretty much any protocol. This is accomplished by creating a secure tunnel and then routing another protocol’s traffic through that tunnel. By principle, it works very similarly to a VPN.

In this guide, we’ll go over the step by step instructions to show you how to use SSH port forwarding to create a secure tunnel for some other application. As an example, we’ll create port forwarding for the telnet protocol, which is usually avoided because of how it transfers data in clear text. This will secure the protocol and make it safe to use.

In this tutorial you will learn:

  • How to use SSH port forwarding
  • How to create a persistent SSH tunnel

Read more