SSH gives you a direct command-line connection to your hosting, on plans that support SSH. If your plan includes it, you'll set up key-based access from cPanel's SSH Access tool, then connect from your terminal with a standard ssh command. Key auth is safer and more convenient than a password: no credentials to type on every connection, and no password to leak from a compromised client.
This article covers generating a key pair, getting connected, and fifteen commands that cover most of what you'd actually do once you're in.
Setting up key-based access
Open cPanel from your hosting service, then find SSH Access under Security. From there you can generate a new key pair or import a public key you already have.
- If you generate a key in cPanel, download the private key immediately, it's only shown once.
- If you already have a key pair on your machine, generate one with
ssh-keygen -t ed25519 -C "your-email@example.com"and paste the public key (the.pubfile) into cPanel's import field. - Authorize the key. cPanel adds it to
~/.ssh/authorized_keyson the server for you, so there's no manual file editing involved.
Use a passphrase on the private key itself. It's a second layer if the key file ever ends up somewhere it shouldn't. An ssh-agent will cache the unlocked key for your session so you're not typing the passphrase on every connection.
Connecting
From a terminal, connect with:
ssh -i ~/.ssh/your_private_key username@yourdomain.com
If you saved the key at the default path (~/.ssh/id_ed25519 or ~/.ssh/id_rsa), you can drop the -i flag entirely, SSH checks the default locations automatically. The username here is your hosting account username, the same one used for FTP and SFTP. See changing your hosting account password if you need a refresher on where that account-level password lives (it's separate from your key, and only needed if you fall back to password auth).
First connection will prompt you to confirm the server's fingerprint. Accept it, and SSH remembers the server for future connections.
15 commands worth knowing
These cover navigation, file management, and basic diagnostics without touching anything you shouldn't on shared infrastructure.
pwd, prints your current directory. Good first command after connecting, so you know where you landed.ls -la, lists files including hidden ones, with permissions and sizes.cd public_html, moves into your site's document root.cat filename, prints a file's contents to the screen. Good for quick checks, not for editing.tail -f error_log, streams a log file live as new lines are written. Stop it with Ctrl+C.grep "search term" file.log, searches a file for a string. Add-rto search recursively through a directory.du -sh *, shows the size of each file and folder in the current directory, useful for finding what's eating storage.df -h, shows overall disk usage for your account.cp source.txt destination.txt, copies a file. Add-rto copy a directory.mv oldname.txt newname.txt, moves or renames a file.rm filename, deletes a file. There's no undo, double-check the path before running it, and never runrm -rfwithout being certain of the target.chmod 644 filename, sets file permissions.755is the usual setting for directories and executable scripts.tar -czvf archive.tar.gz foldername, compresses a folder into a single archive, handy before a big move or as a manual backup.unzip archive.zip, extracts a zip archive in place.which php, prints the path to the active PHP binary, useful when a script behaves differently on the command line than it does in the browser.
Where SSH fits with other ways to manage your site
SSH is one of a few ways to work with your files directly. If you're deploying from a repository instead of managing files by hand, see deploying with git, key-based auth is the same idea applied to automated deploys, so the setup above doubles as prep work for CI. If you're running a Node.js process rather than poking around static files, deploying a Node.js app covers the cPanel Node.js Selector, which manages the process for you instead of running it manually from a shell.
For anything destructive or unfamiliar, run it on a test file first, or open a ticket from Support in the portal before you touch production. Real humans staff the tickets and live chat, and they'd rather walk you through a risky command than clean up after one.