Jack Wallen shows you how to make SSH connections even easier from your macOS machine.
You probably use SSH to connect to remote machines for admin purposes. Generally speaking, SSH is quite easy to use. Open your macOS terminal app and issue a command like:
ssh 192.168.1.20
As long as your usernames are the same on both ends, you’re good to go. But if your usernames aren’t the same, that command might look like:
ssh [email protected]
Now, what happens if you remote into 10 or 20 different machines throughout the day, each with different usernames and IP addresses? That can get a bit confusing after a while. What if I told you that SSH can use a configuration file to make it much easier? By making use of the SSH configuration file, you can configure an entire data center worth of SSH connections such that you could issue a command:
ssh web1
Or:
ssh db1
How do you do that on macOS? Let me show you.
SEE: Use TechRepublic Premium’s identity theft protection policy.
The only thing you’ll need is a MacBook or iMac that includes SSH and some remote servers to connect to. With those at the ready, let’s make this happen.
The first thing you need to do is to change your user SSH directory.
To do this:
cd ~/.ssh
You will now need to create the first configuration.
nano config
Host nextcloud HostName 192.168.1.20 User vega IdentityFile ~/.ssh/id_rsa
Host 192.168.1.* User USERNAME
Where USERNAME is the user on the remote machines.
Host nextcloud HostName 192.168.1.20 IdentityFile ~/.ssh/id_rsa Host web1 HostName 192.168.1.25 Host db1 HostName 192.168.1.100 IdentityFile ~/.ssh/db_rsa.pub
ssh nextcloud ssh web1 ssh db1
And that’s all there is to creating an SSH config file to be used on macOS.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.