SSh Hosts and Private Keys
You work with many remote networks on a daily basis as a server administrator. Throughout your job, you may need to SSH into systems several times. You can access several remote Linux servers with a password, and you can even access them with a private key. As a result, managing all of them might be more typical.
This article will show you the best way to manage SSH Hosts and Private Keys.
Syntax of the Configuration File:
Multiple ssh hosts may be defined in the /.ssh/config
file. Use your favorite editor, such as vi, vim, or nano,
to edit the configuration file.
1. Configure the First SSH Host
For instance, our first SSH host is running a PHP development web server with the following details: nickname php-web1,
user root, port 22,
and password access. In the configuration file, add the following content.
2. Configure a second SSH host
On default port 22,
our second host server (php-web2)
is accessible via ssh key-pair with user root. In the configuration file, add the following content.
Now try SSH with the command below.
3. Add a third SSH host server
Our third ssh host server (php-db1)
is accessible via key-pair with user ubuntu on port 2222.
In the configuration file, add the following content.
Now try SSH with the command below.
4. Use SSH to set up forwarding
In this setup, we must forward port 3306
from our local system to remote servers (php-db1)
. In the configuration file, add the following content.
File with Final Configuration
/.ssh/config.
Saad Shafqat
Related posts
New Articles
Fix BlueBubbles Socket Connection Error: Easy Troubleshooting
BlueBubbles enables Android users to use iMessage, creating a bridge between Apple’s messaging system and non-Apple devices. However, users may…