This page contains affiliate links — if you purchase through our links, we earn a small commission at no extra cost to you.

SSH Access Guide for Web Hosting

Complete guide to secure server connection: setup, authentication methods, essential commands, and security best practices

SSH Access Guide - Server Management

What is SSH and Why Not Telnet

SSH stands for Secure Shell, a network protocol that provides a secure way to connect to remote servers. Before SSH became standard, system administrators relied on Telnet, an older protocol with a critical vulnerability: it transmitted all data in plain text. This means anyone monitoring network traffic could easily capture passwords and sensitive information.

SSH solves this problem through encryption. Every piece of data sent through an SSH connection is encrypted, making it unreadable to anyone attempting to intercept it. Additionally, SSH offers superior authentication methods, including SSH keys, which are far more resistant to brute-force attacks than traditional passwords. Today, SSH is the industry standard for secure remote server access across all hosting types and platforms.

Whether you're using shared hosting, VPS, cloud servers, or dedicated hardware, SSH provides the secure foundation for managing your infrastructure. Its encryption, authentication flexibility, and reliability have made it indispensable in modern web hosting and DevOps environments worldwide.

Which Hosting Plans Include SSH

Not all web hosting plans come with SSH access, but the availability depends on your hosting type. Understanding which plans offer SSH can help you choose the right solution for your needs.

Shared Hosting: Some shared hosting providers include SSH access in their plans, though often as an optional upgrade. When available, SSH on shared hosting is restricted—you can only interact with your own files and directories, not the entire server. This makes sense from a security perspective, as shared servers host multiple customers.

Reseller Hosting: Reseller hosting typically includes full SSH access, allowing resellers to manage their accounts and assist their own customers. This higher level of control reflects the reseller's greater responsibility for their slice of the server.

VPS (Virtual Private Server): VPS is ideal for users who need comprehensive SSH access and full server control. With a VPS, you own a virtual server and can install any software, modify configurations, and manage everything yourself. Providers like AsiaGB.com offer VPS hosting on servers located in Thailand and Singapore, with complete SSH access and 24-hour Thai language support.

Dedicated Server: Dedicated servers offer maximum control and autonomy. You have sole ownership of the physical server, with unrestricted SSH access and complete responsibility for its configuration and security. This is the option for those who need full server independence.

Your First SSH Connection

The first step in using SSH is establishing a connection to your server. The process differs slightly depending on your operating system.

Mac and Linux: Open a terminal application and use the SSH command with your username and server address:

ssh [email protected] -p 22

If your SSH daemon runs on a non-standard port (anything other than 22), use the -p flag followed by the port number. The system will prompt you for your password. When you enter it, note that the terminal won't display the characters you type—this is normal security behavior.

Windows: Modern Windows versions (Windows 10 and newer) have built-in SSH support. You can open PowerShell or Windows Terminal and use the same SSH command as on Mac/Linux. For older Windows versions, download PuTTY, a free SSH client. After installing PuTTY:

  1. Open PuTTY
  2. Enter your server's hostname or IP address in the "Host Name" field
  3. Confirm the port is set to 22
  4. Click Open
  5. Enter your username and password when prompted

SSH Key Authentication Setup

While password-based SSH login works, SSH keys offer significantly better security. An SSH key pair consists of a public key (placed on the server) and a private key (kept only on your computer). When connecting, SSH verifies that these keys match, granting access without requiring a password.

Generating SSH Keys: First, create an SSH key pair on your computer. On Mac, Linux, or Windows PowerShell, run:

ssh-keygen -t ed25519 -C "[email protected]"

This command generates a modern, secure Ed25519 key pair. When asked where to save it, press Enter to use the default location (~/.ssh/id_ed25519). You'll then be prompted to set a passphrase, which adds an extra layer of security by protecting your private key.

Uploading Your Public Key: The easiest method on Mac/Linux is using ssh-copy-id:

ssh-copy-id [email protected]

This command copies your public key to the server and sets correct permissions automatically. On Windows or when using PuTTY, you'll need to manually upload the public key or edit the server's ~/.ssh/authorized_keys file directly.

Connecting with SSH Keys: Once your public key is configured, you can connect using the same SSH command:

ssh [email protected]

If prompted for a passphrase, enter it. You'll log in without needing to provide a password, making authentication both faster and more secure.

Essential SSH Commands You'll Use

After connecting via SSH, you'll need commands to manage your server. Here are the most important ones you'll use regularly.

ls: Lists files and directories in your current location:

ls
ls -la

The -la option shows all files (including hidden ones) with detailed information like permissions and ownership.

cd: Changes your current directory:

cd /path/to/directory
cd ..
cd ~

cd ~ takes you to your home directory, while cd .. moves you to the parent directory.

pwd: Displays the full path of your current directory:

pwd

cp: Copies files or directories:

cp file.txt file_copy.txt
cp -r directory/ directory_copy/

mv: Moves or renames files:

mv old_name.txt new_name.txt
mv /path/file.txt /new/path/file.txt

rm: Removes files (warning: deletion is permanent):

rm file.txt
rm -rf directory/

chmod: Modifies file permissions:

chmod 644 file.txt
chmod 755 script.sh

grep: Searches for text within files:

grep "search_term" file.txt
grep -r "search_term" /path/

tail: Displays the last lines of a file, useful for monitoring logs:

tail /var/log/apache2/error.log
tail -f /var/log/apache2/error.log

The -f flag continuously monitors the file, showing new entries in real-time as they're added.

File Transfer with SCP and SFTP

Beyond executing commands on your server, you'll need to transfer files between your computer and the server. Both SCP and SFTP provide secure methods for this, using SSH's encryption.

SCP (Secure Copy Protocol): SCP offers a straightforward way to copy files via SSH. From your computer, upload files using:

scp file.txt [email protected]:/home/username/
scp -r local_folder/ [email protected]:/home/username/

To download files from the server:

scp [email protected]:/home/username/file.txt ./

SFTP (SSH File Transfer Protocol): SFTP is similar to traditional FTP but secure. It provides an interactive interface for browsing and managing files:

sftp [email protected]

Once connected, you can use commands like ls, cd, put (upload), and get (download). SFTP's advantage is that you can browse the server interactively without memorizing exact file paths, making it more user-friendly for complex file operations.

SSH Tunneling and Port Forwarding

SSH tunneling is an advanced technique that creates secure connections to services running on your server. For example, if your MySQL database only listens on localhost (127.0.0.1:3306), you can safely access it from your computer using SSH tunneling.

Local Port Forwarding: This technique forwards a port on your computer to a service on the server:

ssh -L 3306:127.0.0.1:3306 [email protected] -N

This command opens port 3306 on your local computer and forwards it to the server's database. You can then connect to your database using localhost:3306. The -N flag tells SSH not to open an interactive shell, just create the tunnel.

Remote Port Forwarding: Remote forwarding does the opposite—it forwards a port on the server back to your computer, useful for sharing services running locally:

ssh -R 8080:127.0.0.1:3000 [email protected] -N

This command makes port 8080 on the server accessible to port 3000 on your computer, allowing remote users to access your local service securely.

Securing Your SSH Server

If you own your server (VPS or Dedicated), securing SSH is critical. Attackers actively attempt to compromise SSH access to gain server control. These practices significantly improve your security.

Change the Default SSH Port: SSH uses port 22 by default, which attackers know. Changing it to a non-standard port (like 2222) dramatically reduces unauthorized login attempts. Edit /etc/ssh/sshd_config and change Port 22 to Port 2222, then restart SSH:

systemctl restart sshd

Disable Root Login via SSH: Never allow direct root access via SSH. Instead, create regular user accounts and use sudo for administrative tasks. In sshd_config, change PermitRootLogin yes to PermitRootLogin no.

Disable Password Authentication: Once you've configured SSH keys, disable password login entirely. In sshd_config, change PasswordAuthentication yes to PasswordAuthentication no. This eliminates the risk of password-based attacks entirely.

Use Fail2Ban: Fail2Ban monitors failed login attempts and automatically blocks IP addresses that exceed a threshold. This provides excellent protection against brute-force attacks. Most VPS providers offer easy Fail2Ban installation.

Keep Your System Updated: Always apply security patches promptly. Reputable providers like AsiaGB.com automatically manage updates on shared and managed hosting, but with a VPS, verify that security patches are applied regularly.

SSH Config File Shortcuts

Managing multiple servers becomes tedious if you repeatedly type usernames, hostnames, and ports. The SSH config file simplifies connections by storing these details for reuse.

Create or edit ~/.ssh/config with entries for each server:

Host myserver
  HostName server.com
  User username
  Port 2222
  IdentityFile ~/.ssh/id_ed25519

Host anotherserver
  HostName another.com
  User anotheruser
  Port 22
  IdentityFile ~/.ssh/id_rsa

With this configuration, you can connect simply by typing:

ssh myserver

SSH automatically reads your config file and applies the stored settings. This time-saving technique becomes invaluable when managing multiple servers.

Recommended AsiaGB.com — Web hosting & VPS we use and recommend. Servers in Thailand and Singapore, SSD storage, DirectAdmin control panel, 24-hour Thai language support, 99% uptime.

Professional hosting with local server locations, responsive Thai support team, and full SSH access for complete server control.

Visit AsiaGB →

Frequently Asked Questions

I lost my SSH private key. What should I do?
Generate a new key pair and upload the public key to your server again. If you can't access the server, contact your hosting provider to reset your authorized_keys file or provide emergency access credentials.
What protocol does SSH use?
SSH operates over TCP/IP, using port 22 by default. It employs encryption algorithms like AES-256 to protect your communications and data from eavesdropping.
Can I use SSH on shared hosting?
Some shared hosting providers offer SSH access, though often with limitations. Contact your provider to confirm whether SSH is enabled and what restrictions apply to your account.
Why is SSH more secure than Telnet?
SSH encrypts all data, including passwords and commands, making it unreadable if intercepted. Telnet sends everything in plain text, exposing sensitive information to anyone monitoring your connection.
What's the difference between SCP and SFTP?
SCP is simpler and faster for direct file copying. SFTP provides a full file transfer protocol with interactive browsing, directory creation, and more flexibility for managing files on the server.
I forgot my SSH password. How can I access my server?
If SSH keys are configured, you can authenticate using them instead of your password. If you only used passwords, contact your hosting provider to reset your credentials.