HostName, LocalHostName & SSH


A Short Story
Just a while ago, I met someone with a deep sense of curiosity. Because of his inquisitive mind, he knows more than I do—whether it be about technical topics, health-related matters, or life problems and their solutions.
This was the third time I met this person, but this time, he sparked in me the desire to be more curious, to dig deep into learning a topic, understanding people, books, life, and every possible field I could think of.
This boy does not come from a technical background, yet he possesses more knowledge and understands loopholes better than I have ever studied or come across. He doesn’t confine himself to just one field; instead, he explores multiple disciplines and dimensions.
At one point, he was telling me about the things he had seen on the dark web. That piqued my curiosity again. I asked him how to access the dark web and navigate it to explore things that are generally unavailable on the surface web.
From that day onwards, I started tinkering around the web, learning basic concepts and exploring simple yet intriguing topics—things that sparked my curiosity and might spark yours too.
So, this is the long story short of why I am writing a blog on this topic and why you might find it worth reading.
Understanding LocalHost and HostName with a Story
Imagine you are at a big party, and every guest has a unique name. Let's say your friend John is also there, but instead of just "John," he is identified as "John’s Laptop." This unique name is known as the Host Name—a label assigned to a device for identification within a network.
HostName = A unique identifier assigned to a computer in a network. It is used for network communication and remote access via protocols like SSH (which we will discuss later).
Command to get HostName:
scutil --get ComputerName
Now, imagine you want to ask yourself whether you should drink at that party or not. Instead of calling out your own name, you simply think about it internally. This is similar to LocalHost. The LocalHost Name is like a special identifier that means "me" or "this computer."
LocalHost Name = On macOS, also known as the Bonjour name. It allows other devices on the local network to discover and connect to your computer.
Command to get LocalHost Name:
scutil --get LocalHostName
SSH (Secure Shell)
SSH stands for Secure Shell. It is a protocol used for securely sending commands to a computer over an unsecured network.
It uses cryptography to authenticate and encrypt connections between devices.
Often used for remotely controlling servers, managing infrastructure, and transferring files securely.
What Does SSH Do?
Remote Encrypted Connections:
SSH establishes a secure connection between a user’s device and a remote machine, often a server.
The data exchanged is encrypted, preventing unauthorized access.
Tunneling (Port Forwarding):
Tunneling is a networking technique that allows data packets to travel through a secure path that would not be accessible otherwise.
SSH tunnels use port forwarding to securely send packets between machines.
Understanding SSH with a Story
Imagine you are a secret agent named Thomas Shelby, working for a top-secret organization. You need to access and control a highly classified server located in a secure facility on the other side of the world. However, the network between you and the server is not secure.
In this case, SSH acts as a secure, encrypted tunnel that allows you to send commands without anyone intercepting or reading them. Before accessing the server, you need to authenticate yourself. Once authenticated, you can control the server remotely.
But SSH is not just about sending commands; it also allows tunneling through networks, similar to a secret passageway that lets you move undetected. Instead of taking usual routes, SSH provides a temporary, secure pathway for data packets to travel using port forwarding.
Example:
If you need to access a website that is blocked in your region, you can use SSH to create a tunnel to a server located in a different country where the site is accessible. Your internet traffic will appear to come from that server, allowing you to bypass local restrictions.
In Summary
SSH is a secure communication protocol that enables you to:
Remotely control servers
Transfer files securely
Bypass network restrictions
Encrypt data transmissions to prevent unauthorized access
All while keeping your data safe and protected from potential threats.
If you’ve read this far, please like, comment, and share your feedback!
Subscribe to my newsletter
Read articles from SATYA directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

SATYA
SATYA
Satya Prakash Dwivedi, a self-taught web developer and student, is passionate about creating beautiful and functional web experiences. He contributes to open-source projects and enjoys educating school students.