How to Enable SSH Access to Your Server

Introduction

Secure Shell (SSH) is a crucial tool for remote server management, allowing users to securely access and control their servers via a command-line interface. Whether you're a developer, system administrator, or website owner, enabling SSH access can significantly enhance your ability to manage your server. This guide will walk you through the steps to enable SSH access on your server, covering different control panels and server environments.

Step 1: Check if SSH is Already Enabled

Before enabling SSH, check if it is already active on your server.

  • On Linux/macOS, open a terminal and type:

    ssh your-user@your-server-ip

    BashCopy

  • If you receive a connection prompt, SSH is already enabled.

  • If the connection is refused, follow the next steps to enable SSH.

Step 2: Enable SSH Access viacPanel

  1. Log into cPanel

    • Access your cPanel by navigating to https://yourdomain.com/cpanel.

  2. Go to SSH Access

    • Find the SSH Access option under the Security section.

  3. Manage SSH Keys

    • Click Manage SSH Keys to create a new key pair (public and private).

    • Select Generate a New Key, enter a passphrase (optional), and click Generate Key.

    • Authorize the newly created key under Manage Keys.

  4. Download and Use Your SSH Key

    • Click View/Download the private key and save it to your computer.

    • Use an SSH client like PuTTY (Windows) or OpenSSH (Linux/macOS) to connect.

Step 3: Enable SSH Access via DirectAdmin

  1. Log into DirectAdmin

    • Navigate to your DirectAdmin panel: https://yourdomain.com:2222.

  2. Check User-Level Access

    • Go to Account Manager > SSH Keys.

    • If the option is not available, contact your hosting provider to enable SSH.

  3. Create an SSH Key Pair

    • Click Create SSH Key, generate the keys, and download the private key.

    • Use an SSH client to connect.

Step 4: Enable SSH Access via Plesk

  1. Log into Plesk

    • Access Plesk via https://yourdomain.com:8443.

  2. Enable SSH for Your User Account

    • Navigate to Websites & Domains > Hosting & DNS > Web Hosting Access.

    • Set the Access to the server over SSH option to /bin/bash or another shell.

  3. Use SSH to Connect

    • Open a terminal and connect using:

      ssh your-user@your-server-ip

      BashCopy

Step 5: Enable SSH Access on Linux Servers (Without a Control Panel)

If you are using a VPS or Dedicated Server without a control panel, you may need to enable SSH manually.

Install and Start the SSH Service

On Ubuntu/Debian-based servers:

sudo apt update && sudo apt install openssh-server -y
sudo systemctl enable ssh
sudo systemctl start ssh

BashCopy

On CentOS/RHEL-based servers:

sudo yum install -y openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd

BashCopy

AdjustFirewallSettings

If your firewall blocks SSH connections, allow SSH access:

sudo ufw allow ssh  # For Ubuntu/Debian
sudo firewall-cmd --permanent --add-service=ssh && sudo firewall-cmd --reload  # For CentOS/RHEL

BashCopy

Verify SSH Status

Check if SSH is running with:

sudo systemctl status ssh

BashCopy

Step 6: Secure Your SSH Access

To enhance security, follow these best practices:

  • Change the Default SSH Port (e.g., from 22 to another number):

    • Edit the SSH configuration file: sudo nano /etc/ssh/sshd_config

    • Change Port 22 to another port (e.g., Port 2222), save, and restart SSH: sudo systemctl restart ssh

  • Disable Root Login:

    • Edit sshd_config and set PermitRootLogin no.

  • Use SSH Keys Instead of Passwords:

    • Generate an SSH key using ssh-keygen and copy it to the server with ssh-copy-id your-user@your-server-ip.

Conclusion

Enabling SSH access to your server allows for secure and efficient management. Whether you're using cPanel, DirectAdmin, Plesk, or a standalone Linux server, following these steps ensures you can access your server safely. Always prioritize security by using strong authentication methods and limiting SSH access where necessary.

Last updated

Was this helpful?