Using Linux to SSH and SCP Files Over to Your Hosting Account

Getting Started | Updated March 2026

SSH and SCP are the most direct ways to manage your hosting account from a Linux machine. SSH gives you a command-line shell on your hosting server, while SCP lets you copy files securely between your local machine and the server. Both are built into every Linux distribution and use encryption for all traffic.

01. Connecting via SSH

# Basic connection
ssh [email protected]

# Connect to a specific server (if domain uses Cloudflare/proxy)
ssh [email protected]

# Connect on a specific port (default is 22)
ssh -p 22 [email protected]

The first time you connect to a server, you'll see a fingerprint verification prompt. Type yes to accept and save the server's key. Subsequent connections won't ask again unless the server's key changes.

Once connected, you're in your home directory (/home/username/). Your website files are in public_html/.

02. Uploading Files with SCP

# Upload a single file
scp myfile.html username@server:~/public_html/

# Upload to a specific subdirectory
scp image.png username@server:~/public_html/images/

# Upload multiple files
scp file1.html file2.html file3.css username@server:~/public_html/

# Upload an entire directory recursively
scp -r mysite/ username@server:~/public_html/

# Upload with compression (faster for text files over slow connections)
scp -C largefile.sql username@server:~/

03. Downloading Files with SCP

# Download a single file to current directory
scp username@server:~/public_html/wp-config.php ./

# Download to a specific local path
scp username@server:~/public_html/wp-config.php /tmp/backup/

# Download an entire directory
scp -r username@server:~/public_html/ ./site-backup/

# Download a database dump
scp username@server:~/backup.sql.gz ./

04. Using SSH Keys (Passwordless Login)

SSH key authentication is more secure than passwords and lets you connect without typing a password each time:

  1. Generate a key pair (if you don't already have one):
    ssh-keygen -t ed25519 -C "[email protected]"

    Press Enter to accept the default file location. Set a passphrase for extra security or leave it empty.

  2. Copy the public key to the server:
    ssh-copy-id [email protected]

    Enter your cPanel password when prompted. This copies your public key to ~/.ssh/authorized_keys on the server.

  3. Test the connection:
    ssh [email protected]

    You should connect without being asked for a password (you may be asked for your key passphrase if you set one).

Tip

Add an SSH config entry to simplify connections further. Create or edit ~/.ssh/config:

Host mysite
    HostName web150.ultrawebhosting.com
    User username
    IdentityFile ~/.ssh/id_ed25519

Then connect with just: ssh mysite or scp file.txt mysite:~/public_html/

05. Common SSH Tasks

Check Disk Usage

du -sh ~/public_html/
du -sh ~/public_html/*/ | sort -rh | head -10

Find Large Files

find ~/public_html/ -type f -size +50M -exec ls -lh {} \;

Compress a Directory for Download

tar czf ~/backup.tar.gz ~/public_html/
scp username@server:~/backup.tar.gz ./

Extract an Upload

cd ~/public_html/
unzip uploaded-theme.zip
# Or for tar.gz
tar xzf uploaded-files.tar.gz

Edit a File

nano ~/public_html/wp-config.php
# Or
vi ~/public_html/.htaccess

For more details on SSH access and available commands, see our comprehensive SSH access guide. For FTP-based transfers from Linux, see our Linux FTP/SFTP guide.

Need SSH Access Enabled?

SSH access may not be enabled by default on your hosting account. If you get "connection refused" on port 22, open a support ticket and we'll enable shell access.

Open a Support Ticket

Quick Recap: Linux SSH and SCP

  1. Connect with SSH - ssh username@server for a remote shell
  2. Upload with SCP - scp file username@server:~/public_html/
  3. Download with SCP - scp username@server:~/file ./
  4. Set up SSH keys - ssh-copy-id for passwordless authentication
  5. Use an SSH config - Simplify connections with host aliases in ~/.ssh/config

Last updated March 2026 · Browse all Getting Started articles

  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

Do I have to have a domain name?

Getting Started | Updated 2026 No, you do not need to already own a domain name to get...

How to Install Shopping Cart Software

Getting Started | Updated March 2026 The easiest way to add a shopping cart or e-commerce to...

SSH Access - How to Connect to Your Hosting Account

Getting Started | Updated March 2026 SSH (Secure Shell) gives you command-line access to your...

What directory do I upload to?

Article Updated This article has been consolidated Upload directory information is in our...

How to Use FileZilla and Other Popular FTP Client Software

FTP | Updated March 2026 FTP (File Transfer Protocol) is the standard way to upload files to...



Save 30% on web hosting - Use coupon code Hosting30