In short
There are two ways to connect to cPanel over SSH: the cPanel Terminal tool in your browser, or an SSH client on your own computer. For the second, you generate or import a key under SSH Access in cPanel, authorize it, and connect with ssh -p port user@domain. Shared hosting has no root or sudo; you manage only your own files.
In this guide
- What Is SSH and Why Does It Matter in cPanel?
- Method 1: Connect from Your Browser with cPanel Terminal
- Method 2: Connect from Your Computer with an SSH Key
- Essential Commands on Shared Hosting
- Permission Limits: What You Can't Do on Shared Hosting
- Connection Problems and Fixes
- Next Step: What You Can Do with SSH
cPanel SSH access lets you manage your hosting account from the command line: installing dependencies with Composer, pulling code with Git, compressing large files, backing up databases or watching log files live takes minutes in File Manager but seconds in a terminal. There are two ways to connect: the Terminal tool inside cPanel, and a connection from your own computer with an SSH key. This guide covers both step by step, then spells out what you can and can't do on shared hosting.
What Is SSH and Why Does It Matter in cPanel?
SSH (Secure Shell) is a protocol that lets you send commands to a remote server over an encrypted connection. Its default port is 22, but many hosting providers use a different port for security. When you connect to a cPanel account over SSH, you work as your own user in your own home directory (/home/kullaniciadi).
Modern projects such as Laravel, Node.js or Python apps are nearly impossible to manage without the command line. That makes SSH access a requirement for developers, not a nice-to-have. Sunucu Atlas developer-focused Laravel hosting plans come with Terminal/SSH access, Composer and Git ready in cPanel.
Method 1: Connect from Your Browser with cPanel Terminal
This is the fastest route; you don't need to install anything.
- Log in to cPanel.
- In the Advanced section, click the Terminal icon.
- Read the warning shown on first launch and confirm with the I understand and want to proceed button.
- A command prompt opens, starting right in your home directory.
Terminal is ideal for quick tasks. During long-running operations, closing the browser tab can end the session and the running command; for big jobs, the next method is more reliable.
Method 2: Connect from Your Computer with an SSH Key
An SSH key is a pair made up of a private key (stays on your computer) and a public key (added to the server). It's far more secure than a password and resists brute-force attempts.
Step 1: Generate a key on your computer
Windows 10/11, macOS and Linux ship with the OpenSSH client. Run this command in PowerShell or Terminal:
ssh-keygen -t ed25519 -C "cpanel-hesabim"When asked for a file location, press Enter to accept the default, and set a passphrase to protect your key. Your public key is created at ~/.ssh/id_ed25519.pub. To view its contents:
# macOS / Linux
cat ~/.ssh/id_ed25519.pub
# Windows PowerShell
Get-Content $env:USERPROFILE\.ssh\id_ed25519.pubIf an older system doesn't support ed25519, you can use ssh-keygen -t rsa -b 4096.
Step 2: Add the public key to cPanel and authorize it
- In cPanel, open the SSH Access tool under Security.
- Click Manage SSH Keys, then choose Import Key.
- Give the key a name and paste the contents of the
.pubfile into the Public Key field. Leave the private key field empty. - Once the import finishes, click the Manage link next to the key in the list and authorize it with Authorize.
An unauthorized key is not used for login, even if it shows up in the list; this is the most commonly skipped step. You can also create the key on the server with cPanel's Generate a New Key option, but then you have to download the private key, and the key will have existed on the server at least once. Generating it on your own computer is the better habit.
Step 3: Connect
Connect with the SSH port number your hosting provider gave you and your cPanel username:
ssh -p 22 kullaniciadi@alanadiniz.comReplace 22 with the port you were given. On the first connection you'll be asked to confirm the server's fingerprint; type yes. If you connect often, add a short entry to your ~/.ssh/config file:
Host hostingim
HostName alanadiniz.com
User kullaniciadi
Port 22
IdentityFile ~/.ssh/id_ed25519Now just typing ssh hostingim is enough. If you use PuTTY, you'll need to convert the key to .ppk format with PuTTYgen. For a deeper dive into keys, see the create an SSH key and disable password login guide.
Essential Commands on Shared Hosting
| Task | Command |
|---|---|
| Show the current directory | pwd |
| List files, including hidden ones | ls -la |
| Show folder sizes | du -sh ~/* | sort -h |
| Find large files | find ~ -type f -size +100M |
| Archive a folder | tar -czf yedek.tar.gz public_html |
| Unzip a file | unzip dosya.zip -d hedef |
| Back up a database | mysqldump -u kullanici_db -p veritabani > yedek.sql |
| Watch a log file live | tail -f public_html/error_log |
| Search inside files | grep -rn "aranan" public_html |
| PHP and Composer version | php -v and composer --version |
| Edit a file | nano dosya.php |
File transfer: scp and rsync
Once SSH access is on, you no longer need FTP to transfer files. scp is for single files, while rsync is ideal for large folders because it only sends changed files. Run these commands on your own computer:
# Upload a single file to your hosting
scp -P 22 yedek.zip kullaniciadi@alanadiniz.com:~/
# Download a file from your hosting to your computer
scp -P 22 kullaniciadi@alanadiniz.com:~/yedek.tar.gz .
# Sync a folder (only changed files are transferred)
rsync -avz -e "ssh -p 22" ./site/ kullaniciadi@alanadiniz.com:~/public_html/Note that scp uses an uppercase -P for the port, while ssh uses a lowercase -p. In rsync, a trailing slash on the source folder transfers its contents rather than the folder itself; this detail prevents nested folders from ending up in the wrong place. rsync isn't built into Windows; you can use WSL or stick with scp.
Safe working habits
- Before bulk deleting or moving, check which directory you're in with
pwd;rm -rfcan't be undone. - Make a copy before editing an important file:
cp .htaccess .htaccess.bak. - Don't type passwords directly on the command line; commands like
mysqldump -pprompt for the password separately, so it isn't saved in your command history.
File permissions
On cPanel, PHP usually runs as your account's user. The correct permissions are 755 for folders and 644 for files; 777 is unnecessary and on many servers causes a 500 error for security reasons. To fix permissions in a folder in bulk:
find public_html -type d -exec chmod 755 {} \;
find public_html -type f -exec chmod 644 {} \;Permission Limits: What You Can't Do on Shared Hosting
On shared hosting, SSH is usually provided as an isolated (jailed) shell. You can't see other accounts or touch the system as a whole. This protects you and your neighbors alike. In practice, these are the limits:
- No root and no sudo. System package installs such as
apt installoryum installaren't possible. - You can't manage system services. You can't restart Nginx, MySQL or PHP services; you change PHP settings through the PHP selector in cPanel.
- Persistent background processes aren't a good fit. An always-on queue worker or your own web server can hit resource limits and get terminated. Use cron for scheduled jobs.
- You can't bind to ports below 1024 or change the firewall.
- Resource limits apply. Your plan's CPU and RAM limits also apply to commands you run in the terminal, which is why a large
composer updatemay run slowly.
If these limits start to feel tight for your project, for example if you need Docker, Redis or an always-on service, it's time to move to a server with root access. We cover that decision in the when to move from shared hosting to a VDS guide.
Connection Problems and Fixes
- Permission denied (publickey): the key isn't authorized in cPanel or the wrong key is being used. Run
ssh -v -p PORT kullaniciadi@alanadiniz.comto see which key is being tried. - Connection refused or timed out: the port number is wrong, SSH access is disabled on your account, or your IP address has been temporarily blocked after too many failed attempts.
- Username: use your cPanel username, not your email address.
- "ssh is not recognized" on Windows: enable OpenSSH Client under Settings > Apps > Optional features.
Next Step: What You Can Do with SSH
Once SSH access is set up, the most common workflows are installing a Laravel project with Composer (how to deploy a Laravel project on cPanel hosting), pulling code with Git, and entering the virtual environment of a Node.js or Python app to install packages.
If you like working on the command line and want to do it without extra setup hassle, check out our Laravel hosting plans with Terminal/SSH, Composer and Git. The plans come with the LiteSpeed web server, NVMe storage and PHP version selection up to 8.5; the entry-level SA-DEV-1 is enough for a single project, while busier projects that also need access and error logs can look at the higher plans. If you get stuck connecting, you can open a support ticket with the Sunucu Atlas support team.
Frequently asked questions
What are my cPanel SSH username and password?
Your username is your cPanel username, not your email address. If password login is enabled, you use your cPanel password, but connecting with an SSH key is more secure.
What is the cPanel SSH port?
The default SSH port is 22, but many hosting companies use a different port for security. You can find the correct port in your hosting provider's welcome email or by asking their support team.
Is there a difference between cPanel Terminal and SSH?
Both give you access to the same shell. Terminal runs in your browser and needs no setup; connecting with an SSH client is more stable for long tasks, file transfers and automation.
Can I use sudo or apt on shared hosting?
No. Shared hosting has no root privileges, so you can't install system packages or manage services. For those needs you need a VDS with root access.
I added my SSH key to cPanel but can't connect. Why?
The most common reason is that the key hasn't been authorized under SSH Access. Also check the port number and that the correct private key is being used with ssh -v.