Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rank-math domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/u596154002/domains/usbusinessreviews.com/public_html/wp-includes/functions.php on line 6114
How to make SSH even easier to use with config files - Best Business Review Site 2024

How to make SSH even easier to use with config files

[ad_1]

Secure Shell (SSH) is one of those tools every Linux user will probably work with at some point. With SSH you can easily (and securely) log into remote servers and desktops to administer, develop, and check up on those machines.

Using SSH is as simple as:

ssh jack@192.168.1.11

Or even just:

ssh 192.168.1.11

Of course, you would exchange the IP address for the address (or domain) of the machine you need to access. 

ZDNet Recommends


The best Linux Foundation classes


The best Linux Foundation classes


Want a good tech job? Then you need to know Linux and open-source software. One of the best ways to learn is via a Linux Foundation course.

SSH gets a bit less simple when you have numerous machines you access with different configurations (such as different usernames or SSH authentication keys). Imagine if you had 20 or so different servers you had to log into daily. Not only would you have to keep track of the IP addresses or domains of those servers, but you’d also have to remember what usernames or authentication keys were used. That alone could get rather overwhelming.

Thankfully, SSH allows you to create a config file to house all of that information. So, instead of having to type something like ssh olivia@192.168.1.100 -p 2222, you could simply type ssh web1

Let me show you how this is done.

Creating the SSH config file

Log in to the Linux machine you use to SSH into all of those remote machines. Open a terminal window and create the new configuration file with the command shown in Figure A.

Figure A

sshconfig1.jpg

Creating the new SSH config file with the help of nano.

Since this is a new file, it’ll be a blank canvas to which we can start adding configurations for servers. Let’s say you want to configure the following remote servers:

  • web1 at 192.168.1.100 with user olivia

  • db1 at 192.168.1.101 with user nathan and SSH key ~/.ssh/id_nathan

  • docker1 at 192.168.1.102 with user lilly on port 2222

Our first entry will look like this:

Host "web1"
     Hostname "192.168.1.100"
     User olivia

If you save and close the file at this point, you could SSH into 192.168.1.100 with the command:

ssh web1

Let’s go ahead and configure the next two entries, which will look like this:

Host db1
     Hostname "192.168.1.101"
     User nathan
     IdentityFile ~/.ssh/id_nathan
     PubkeyAuthentication yes

Host docker1
     Hostname "192.168.1.102"
     User lilly
     Port 2222

Save and close the file. You can now secure shell into those machines with the commands:

ssh web1
ssh db1
ssh docker1

You can use whatever nickname you need for each host, just make them memorable, so you don’t forget which machine you’re trying to reach and have to constantly reference the config file to jar your memory.

Let’s say, however, that you use the same username on all your remote servers, but you use a different username on your local machine. For example, your local machine username might be jack but you’ve created the admin user on all of your remote servers. You could create a single entry for all of those servers with a wildcard in the IP address like this:

Host 192.168.1.*
User admin

The above configuration would be placed at the top of your config file.

You could then configure each server individually as needed, leaving out the User option. For example, if both servers at 192.168.1.200 and 192.168.1.201 use SSH key authentication, you could configure entries like so:

Host web2
     Hostname 192.168.1.200
     IdentityFile ~/.ssh/id_admin
     PubkeyAuthentication yes

Host web3
     Hostname 192.168.1.201
     IdentityFile ~/.ssh/id_admin
     PubkeyAuthentication yes

Because we applied user admin to the entire range of machines on IP address scheme 192.168.1.x, that username will be applied to all connections. You can also override that global configuration by adding a User configuration line on an as-needed basis.

The SSH config file allows for several other options (all of which can be read about in the official SSH config documentation), but these examples shown above should be everything you need to get going with the SSH config file. 

And that’s all there is to using the SSH config file to help make your remote access with Secure Shell even easier.

[ad_2]

Source link

slot gacor slot gacor togel macau slot hoki bandar togel slot dana slot mahjong link slot link slot777 slot gampang maxwin slot hoki slot mahjong slot maxwin slot mpo slot777 slot toto slot toto situs toto toto slot situs toto situs toto situs toto situs toto slot88 toto slot slot gacor thailand slot bet receh situs toto situs toto slot toto slot situs toto situs toto situs toto situs togel macau toto slot slot demo slot pulsa slot pragmatic situs toto deposit dana 10k surga slot toto slot link situs toto situs toto slot situs toto situs toto slot777 slot gacor situs toto slot slot pulsa 10k toto togel situs toto slot situs toto slot gacor terpercaya slot dana slot gacor pay4d agen sbobet kedai168 kedai168 deposit pulsa situs toto slot pulsa situs toto slot pulsa situs toto situs toto situs toto slot dana toto slot situs toto slot pulsa toto slot situs toto slot pulsa situs toto situs toto situs toto toto slot toto slot slot toto akun pro maxwin situs toto slot gacor maxwin slot gacor maxwin situs toto slot slot depo 10k toto slot toto slot situs toto situs toto toto slot toto slot toto slot toto togel slot toto togel situs toto situs toto toto slot slot gacor slot gacor slot gacor situs toto situs toto cytotec toto slot situs toto situs toto toto slot situs toto situs toto slot gacor maxwin slot gacor maxwin link slot 10k slot gacor maxwin slot gacor slot pulsa situs slot 10k slot 10k toto slot toto slot situs toto situs toto situs toto bandar togel 4d toto slot toto slot situs toto toto slot toto togel situs toto link situs toto situs toto toto slot situs toto slot gacor https://thebharatschool.com/ bandar togel bandar togel bandar togel toto togel 4d situs toto situs toto https://zer0day.id/