How To Create SSH Aliases on Mac to Connect to Your Hostinger VPS
June 11, 2026 · Mike Murphy
Learn how to create SSH aliases on Mac so you can connect to your Hostinger VPS with shorter, memorable terminal commands.
Description
If you connect to your Hostinger VPS from the Mac terminal, you may be typing a long SSH command every time:
ssh root@123.456.789.000
Or, if you use an SSH key, maybe something even longer:
ssh -i ~/.ssh/my_key root@123.456.789.000
That works, but it gets old fast.
In this tutorial, you will create an SSH config file on your Mac so you can connect to your VPS with a short alias instead:
ssh myvps
No extra tools. No shell scripting. No .zshrc edits. Just the built-in SSH config file that macOS already knows how to use.
What You Will Build
By the end, you will have:
- An SSH config file at
~/.ssh/config - A short SSH alias for your Hostinger VPS
- Your VPS IP address, username, and private key path saved in one place
- A faster command for connecting from Terminal, iTerm2, Warp, or any other Mac terminal app
- A reusable pattern for adding more VPS connections later
Why This Matters
The more often you work on a VPS, the more annoying long SSH commands become.
An SSH alias gives you one memorable shortcut. Instead of remembering the IP address, username, port, and private key path, you save those details once in ~/.ssh/config.
Then you connect with:
ssh myvps
If your VPS IP address changes later, you update one config file. The alias stays the same.
This is one of those developer workflow tricks that has been around forever, but beginner VPS tutorials often skip it. Once you set it up, it feels obvious.
Before You Start
You will need:
- A Mac
- Terminal access
- A Hostinger VPS or any server you connect to with SSH
- Your VPS IP address
- Your SSH username, usually
rooton a default Hostinger VPS - Your private SSH key path, if you use SSH keys
If you do not use SSH keys yet, you can still create an alias with only Host, HostName, and User. But if you already have SSH keys set up, adding IdentityFile makes the alias more reliable.
The Important File: ~/.ssh/config
The SSH config file is a plain text file on your Mac.
It lives here:
~/.ssh/config
That path means:
~is your Mac user home folder.sshis the hidden SSH folderconfigis the file where SSH shortcuts live
This is not your .zshrc file. This is not your .bashrc file. You do not need to edit your shell settings.
For this tutorial, the only file we care about is:
~/.ssh/config
Step 1: Check Your .ssh Folder
Open Terminal on your Mac and run:
ls ~/.ssh/
This shows the files inside your SSH folder.
If you see a file named config, great. You already have the file and can add a new host block to it.
If you do not see config, that is fine. You will create it in the next step.
If the .ssh folder does not exist, create it:
mkdir -p ~/.ssh
What success looks like: your Mac has a ~/.ssh/ folder, and you are ready to open or create the config file.
Step 2: Open Or Create The SSH Config File
Open the config file with nano:
nano ~/.ssh/config
If the file already exists, nano opens it.
If the file does not exist, nano creates a new blank file.
You can use another plain text editor if you prefer, such as VS Code, Cursor, Zed, or BBEdit. Just make sure the file is named exactly:
config
Do not save it as config.txt.
Step 3: Add Your First SSH Alias
Add a host block like this:
Host myvps
HostName 123.456.789.000
User root
IdentityFile ~/.ssh/your_key_name
Replace the placeholder values with your real VPS details.
| Line | What It Does |
|---|---|
Host myvps |
The short alias you will type in Terminal |
HostName 123.456.789.000 |
Your VPS IP address or domain name |
User root |
The SSH username for your VPS |
IdentityFile ~/.ssh/your_key_name |
The private SSH key your Mac should use |
The alias can be almost anything that makes sense to you:
Host hostinger-vps
HostName 123.456.789.000
User root
IdentityFile ~/.ssh/hostinger_vps
Then your connection command becomes:
ssh hostinger-vps
What success looks like: your config file has one Host block with your alias, VPS IP address, username, and private key path.
Step 4: Add More VPS Aliases
You can add more than one host block to the same config file.
For example:
Host myvps
HostName 123.456.789.000
User root
IdentityFile ~/.ssh/your_key_name
Host stagingvps
HostName 98.765.432.100
User ubuntu
IdentityFile ~/.ssh/staging_key
Each Host block is separate.
That means you can have different aliases for different servers:
ssh myvpsssh stagingvpsssh production-vpsssh client-vps
This is where the config file becomes really useful. The connection details stay organized in one place, and your daily commands stay short.
Step 5: Save And Exit Nano
If you are using nano:
- Press
Control + Oto save - Press
Enterto confirm the filename - Press
Control + Xto exit
After you exit, you will be back at the regular terminal prompt.
Step 6: Set The Correct File Permissions
SSH is picky about file permissions.
Run:
chmod 600 ~/.ssh/config
This makes the config file readable and writable only by your Mac user.
You can also make sure the .ssh folder itself has the right permissions:
chmod 700 ~/.ssh
Do not skip this if SSH complains about permissions. A config file with loose permissions can cause confusing errors.
What success looks like: SSH accepts the config file without warning about bad permissions.
Step 7: Test Your SSH Alias
Now connect using the alias:
ssh myvps
Or, if you used a different alias:
ssh hostinger-vps
If this is your first time connecting to that server from this Mac, SSH may ask you to confirm the server fingerprint. Type:
yes
If everything is set up correctly, you will connect to your Hostinger VPS without typing the IP address, username, or key path.
What success looks like: ssh myvps connects to the same VPS as your old long SSH command.
Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
ssh myvps says the host cannot be resolved |
The Host alias does not match what you typed |
Check the exact alias after Host in ~/.ssh/config |
| SSH still asks for a password | The wrong key is being used or no key is configured | Check the IdentityFile path and confirm the key exists in ~/.ssh/ |
| SSH says permissions are too open | The config file or .ssh folder permissions are too loose |
Run chmod 600 ~/.ssh/config and chmod 700 ~/.ssh |
| The connection goes to the wrong server | The HostName value is wrong |
Replace HostName with the correct VPS IP address |
| The alias works in one terminal app but not another | The terminal app may be using a different user or environment | Confirm both apps are running as the same Mac user |
| Nano created an empty file | You opened the file but did not save before exiting | Reopen nano ~/.ssh/config, add the host block, then save with Control + O |
Commands Reference
Check your SSH folder:
ls ~/.ssh/
Create the SSH folder if needed:
mkdir -p ~/.ssh
Open or create the SSH config file:
nano ~/.ssh/config
Set config file permissions:
chmod 600 ~/.ssh/config
Set .ssh folder permissions:
chmod 700 ~/.ssh
Connect with your alias:
ssh myvps
Complete SSH Config Example
Here is a clean starter config for two VPS connections:
Host myvps
HostName 123.456.789.000
User root
IdentityFile ~/.ssh/your_key_name
Host stagingvps
HostName 98.765.432.100
User ubuntu
IdentityFile ~/.ssh/staging_key
After saving that file, you can connect with:
ssh myvps
ssh stagingvps
What This Unlocks Next
SSH aliases make VPS work feel a lot less clunky.
Instead of remembering long commands, IP addresses, usernames, and key paths, you give each server a short name and let your Mac handle the details.
That means:
- No more memorizing VPS IP addresses
- No more typing private key paths every time
- Multiple servers organized in one config file
- Faster terminal workflow when working with Hostinger VPS, Docker, Claude Code, or any other remote server setup
Once you have it set up, connecting to your VPS is as simple as:
ssh myvps
Watch The Video
Watch the full walkthrough here: