How to manage your Hostinger website over SSH (no password, no panel clicking)
The hosting panel (hPanel) is fine for setting things up, but the moment you want to back up your site, upload a new version, or fix something quickly, clicking through menus gets slow. SSH lets you do all of that from a terminal on your own computer, in seconds, and you can repeat it exactly every time.
This guide shows how to set up SSH on Hostinger shared hosting with a key instead of a password, and four things you can do with it.
What SSH is, in one minute
SSH opens a secure text session on your hosting server. You type commands, the server runs them. With a key pair you don’t type a password at all: you keep a private key on your computer and give the server the matching public key. Only the private key can unlock the door, and it never leaves your machine. You can remove the public key from the server at any time to cut off access.
What you need
- A Hostinger plan with SSH access (Premium shared hosting and above; check your plan if you don’t see it in the panel).
- A computer with an SSH client. Windows 10/11, macOS and Linux all have one
built in (type
ssh -Vin a terminal to check).
Step 1: Create a key pair
Do this on your own computer, not on the server:
ssh-keygen -t ed25519 -f ~/.ssh/hostinger -C "my-laptop hostinger"
- Press Enter for no passphrase, or set one for extra safety (then you type it when you connect).
- This creates two files:
hostinger(the private key: never share it) andhostinger.pub(the public key: safe to share).
Show the public key so you can copy it:
cat ~/.ssh/hostinger.pub
Step 2: Add the public key in hPanel
- In hPanel go to Websites, pick your site, then Advanced → SSH Access.
- Turn SSH access on.
- Under SSH keys, paste the whole line from
hostinger.puband save. - Note the three values shown on that page: IP address, port (Hostinger
uses 65002, not the usual 22) and your username (starts with
ufollowed by digits).
Step 3: Save the connection as a shortcut
Add this to ~/.ssh/config (create the file if it doesn’t exist), using your own
values:
Host hostinger
HostName 203.0.113.10
Port 65002
User u123456789
IdentityFile ~/.ssh/hostinger
IdentitiesOnly yes
Now connecting is just:
ssh hostinger
The first time, your computer asks whether you trust the server. Answer yes. If
you land on a prompt that shows the server name, it works. Type exit to leave.
You can also run a single command without opening a session:
ssh hostinger 'ls ~/domains'
Where your website lives
On Hostinger shared hosting each domain has its own folder:
~/domains/yourdomain.com/public_html/ <- the website files
Everything inside public_html is what visitors get. If you host several
domains on one plan, each has its own folder, so always double-check the domain
in the path before you change or delete anything.
Four things to do with it
1. Look around safely
ssh hostinger 'ls -la ~/domains/yourdomain.com/public_html'
ssh hostinger 'du -sh ~/domains/yourdomain.com/public_html' # how big is it
ssh hostinger 'php -v | head -1' # PHP version
Commands that only read (ls, du, cat) change nothing, so use them freely
to find out what is on the server before you act.
2. Back up your site
Make a compressed copy of your website files on the server, then download it to your computer:
ssh hostinger 'tar -czf ~/backup-files.tar.gz -C ~/domains/yourdomain.com public_html'
scp hostinger:backup-files.tar.gz .
Check that the backup really exists before you do anything else:
ssh hostinger 'ls -la ~/backup-files.tar.gz'
Then compare checksums, so you know your copy arrived intact. The two lines must be identical:
ssh hostinger 'sha256sum ~/backup-files.tar.gz'
sha256sum backup-files.tar.gz # on your computer (macOS: shasum -a 256)
If your site uses a database, back that up too. You can find its name and user in hPanel under Databases. This asks for the database password (it isn’t shown while you type):
ssh -t hostinger 'mysqldump -u DBUSER -p --single-transaction --no-tablespaces DBNAME > ~/backup-db.sql'
scp hostinger:backup-db.sql .
Once the files are safely on your computer (or other storage), delete the temporary copies on the server so passwords and data don’t sit around:
ssh hostinger 'rm ~/backup-files.tar.gz ~/backup-db.sql'
3. Upload a new version of your site
If your site is a folder of files on your computer (plain HTML, or the output of a static site generator such as Astro or Hugo), you can upload it in one step without a file manager. This sends a compressed copy straight into a new folder and then swaps it in, keeping the previous version for a quick way back:
tar -C my-site-folder -czf - . | ssh hostinger '
cd ~/domains/yourdomain.com &&
rm -rf public_html.new && mkdir public_html.new &&
tar -xzf - -C public_html.new &&
rm -rf public_html.prev &&
mv public_html public_html.prev &&
mv public_html.new public_html'
Replace my-site-folder with the folder that holds your finished site.
You may see warnings like “time stamp is in the future”. They only mean your computer’s clock and the server’s clock differ slightly. Nothing is wrong.
4. Roll back in one line
If something is wrong with the new version, put the previous one back:
ssh hostinger 'cd ~/domains/yourdomain.com && mv public_html public_html.bad && mv public_html.prev public_html'
Once you’re happy, remove public_html.bad and public_html.prev to free the
space.
Gotchas worth knowing
- Caching hides your changes. Hostinger caches pages in a CDN and in LiteSpeed, so after an update the old page can keep showing for a while. In hPanel use Performance → CDN → Flush cache and Advanced → Cache Manager → Purge all.
- Look before you delete. List a folder and check the domain name in the path before removing or moving anything. Moving something aside is safer than deleting it.
- Keep secrets private. Never share your private key, and don’t put passwords on the command line or in files you upload. Configuration files and database dumps often contain passwords, so keep backups on your own storage.
- Shared hosting limits. You get a normal user, not full control of the
server, so you can’t install system software. PHP,
tar,mysqldump,scpand the other basics all work.
Quick reference
| I want to… | Command |
|---|---|
| Connect | ssh hostinger |
| List my site files | ssh hostinger 'ls -la ~/domains/DOMAIN/public_html' |
| Back up my files | tar -czf on the server, then scp it down |
| Upload a new version | tar … | ssh hostinger 'tar -xzf - …' |
| Roll back | mv public_html.prev public_html |
| Revoke access | remove the key in hPanel → SSH Access |
Is it worth it?
If you only edit a page now and then, hPanel is fine. If you update your site often, or want reliable backups and one-line rollbacks, learning these few commands pays off the first time something goes wrong.