Web750 Support Articles and How-to guides:


cPanel guide to connecting, using and securing SSH access with your account information or SSH keys.


Introduction to Secure Server Access with SSH


SSH is a cryptographic protocol for secure, encrypted remote server access. It establishes authenticated communication, ensuring data privacy and security, vital for admins, developers, and remote tasks. SSH prevents eavesdropping, excelling over traditional methods.


Connecting to Your cPanel Server via SSH


Here's a step-by-step guide to connecting to your server via SSH:


Prerequisites for SSH Access


Before you begin, ensure you have the following prerequisites in place:


SSH Server Enabled: Ensure your server has an SSH server installed and running. Most Linux-based servers come with SSH pre-installed. If not, you can install it using your server's package manager.


SSH Credentials: You'll need the username and password (or SSH key) associated with the server. These credentials authenticate your access.


Connecting to a cPanel Server via SSH Using PuTTY:


Download PuTTY: If you don't have PuTTY installed, download it from the official website: PuTTY Download Page. (Link Below)


Launch PuTTY: Once PuTTY is installed, open the application.


Configure the Connection:


In the PuTTY configuration window that opens:


To connect to a server, type the hostname or IP address into the "Host Name (or IP address)" area.


Ensure the "Port" is set to the SSH port (default 22).


Choose the "Connection type" as "SSH."


Save Session Settings (Optional):


To save these settings for future use:


Name it in the "Saved Sessions" section to save your session.


Click the "Save" button.


Initiate the Connection:


Click the "Open" button to start the SSH connection.


Security Alert:


If you connect to the server for the first time, a security alert will display the server's host key fingerprint.


Verify that the fingerprint matches the expected value, which your server administrator might provide.


Click "Yes" to proceed if you trust the server's identity.


Login:


A terminal window will open, and you'll be asked to log in.


Type in your username and press "Enter."


Next, you'll be prompted to enter your password. Note that the password characters won't appear on the screen for security reasons. Type in your password and press "Enter."


Connected to Server:


If the username and password are correct, you should now be connected to the server via SSH.


You'll have access to the remote server's command-line interface to run commands and manage the server.


Using the Terminal:


You can issue commands to a remote server and view the results using the Terminal. Type in orders and press "Enter" to manage them.


Logout and Disconnect:


To log out from the server, type the command exit and press "Enter." The PuTTY terminal will close, and you'll be disconnected from the remote server.


Connecting to a cPanel Server via SSH Using PuTTY and a private SSH key:


Download and Install PuTTY: If you don't have PuTTY installed, download it from the official website: [Link Below]. Install PuTTY using the installer.


Generate or Obtain an SSH Key Pair: The PuTTY programs PuTTYgen may generate a public and private SSH key pair. Open PuTTYgen and follow its instructions to develop a new critical team. If you already have an SSH key pair, ensure the private key (.ppk file) is on your local machine.


Configure the connections.


Login with Private Key: A terminal window will open, and you'll be prompted to enter your username.


Type in your username and press "Enter."


Since you're using a private key for authentication, you won't be prompted for a password.


Connect to Server:


You'll be connected to the remote server's command-line interface if your private key is correctly configured and matches the public key stored on the server.


Using the Terminal:


To execute instructions on the remote server, you can now use the Terminal.


Logout and Disconnect:


To log out from the server, type the' exit' command and press "Enter."


The PuTTY terminal will close, and you'll be disconnected from the remote server.


Connecting to a cPanel Server via SSH Using macOS or Linux:


Open Terminal:


On macOS, you can find Terminal in the Applications > Utility folder or by using Spotlight search (Cmd + Space and type "Terminal").


On Linux, you can typically find Terminal in the Applications menu or search for "Terminal" in the application launcher.


Use SSH Command:


In the terminal window, use the SSH command followed by the remote server's hostname or IP address. For example:


Switch out "username" for your username on the remote server and "hostname_or_ip" for the server's actual hostname or IP address.


Authenticate:


Press "Enter" after entering the SSH command.


If you're connecting to the server for the first time, you'll be prompted to confirm the authenticity of the host by verifying the server's host key fingerprint. Type "yes" and press "Enter" if you trust the server.


Enter Password or Private Key Passphrase:


Depending on your server's authentication method:


If using a password: Enter your password when prompted. Note that characters won't appear as you type for security reasons. Press "Enter" after entering the password.


If using an SSH key pair: Your SSH agent may automatically handle the critical authentication, or you might be prompted to enter the passphrase for your private key.


Connect to Server:


If your credentials or private key passphrase are correct, you'll be connected to the remote server's command-line interface.


Using the Terminal:


To execute instructions on the remote server, you can now use the Terminal. Type in orders and press "Enter" to manage them.


Logout and Disconnect:


To log out from the server, type the command exit and press "Enter". The terminal session will close, and you'll be disconnected from the remote server.


Managing SSH Keys in cPanel


Generating a New SSH Key in cPanel


Step 1: Access Key Management


Log in to your account. Go to security or SSH key settings.


Step 2: Generate Key


Click "Generate New SSH Key".


Step 3: Specify Key Settings


Choose a fundamental type (RSA or DSA). Pick a critical size (2048, 4096 bits). Add a label if needed.


Step 4: Set Passphrase


Enter a strong passphrase.


Step 5: Generate Keys


Click "Generate" or "Create".


Step 6: Display and Download


Copy the public key. Download the private key (keep it secure).


Step 7: Add Public Key


Log in to the remote server. Open ~/.ssh/authorized_keys. Paste the public key on a new line.


Step 8: Use Private Key


Use a private key for authentication. Enter the passphrase if prompted.


Importing an Existing SSH Key in cPanel


Step 1: Access Key Management


Log in to your account. Navigate to security or SSH key settings.


Step 2: Import Existing Key


Look for an option like "Import SSH Key" or similar.


Step 3: Provide Key Details


Copy the content of your existing public key (usually in the format of ssh-rsa). Paste the public key into the provided field.


Step 4: Label the Key (Optional):


Optionally, provide a label or title for the key for easy identification.


Step 5: Save or Import Key


Click "Save" or "Import" to add the key to your account.


Step 6: Use the Key


Use your existing private key for authentication with systems that recognize the imported public key.


Managing Your SSH Keys in cPanel


SSH keys come in pairs: a public key and a private key. The private key stays on your computer while the public key is stored on the server. To manage SSH keys effectively:


Generating SSH Keys: The ssh-keygen command develops a new key pair. It's essential to set a strong passphrase for your private key.


Storing Keys: Your private key should be stored securely on your local machine. The ~/.ssh directory is a common location. Ensure the directory has appropriate permissions (usually 700) to prevent unauthorized access.


Copying Public Key to Remote Servers: The content of your public key (usually found in ~/.ssh/id_rsa.pub) must be added to the remote server's ~/.ssh/authorized_keys file. Each line in this file represents a different authorized key.


Viewing and Editing SSH Key Details in cPanel:


You can view and edit SSH key details using various commands and tools:


Viewing Key Details: Use the ssh-keygen -l -f "path-to-public-key" command to display information about a specific public key.


Changing Passphrase: You can change the passphrase for your private key using ssh-keygen -p.


Revoking or Removing SSH Keys in cPanel:


If you want to cancel or remove access for a specific key:


Removing from Remote Servers: If the public key is stored in the authorized_keys file on the remote server, it must be deleted. That will prevent that key from being used for authentication.


Regenerating Keys: If a key is compromised or you want to enhance security, you should generate a new key pair and update the authorized keys accordingly.


Organizing SSH Keys for Different Users in cPanel:


When dealing with multiple users or systems, organization becomes crucial:


User-Specific Keys: Each user should have a key pair. Store their public keys in their respective authorized_keys files on remote servers.


SSH Config File: The ~/.ssh/config file can be used to create aliases for hosts and configure SSH options. That is especially helpful when managing connections to multiple servers.


Using Different Keys: Key pairs for other servers or accounts can be used. Specify the appropriate private key using the -I option with the ssh command.


Conclusion:


Mastering the use and security of SSH access through cPanel is an essential skill for anyone responsible for managing a web server. SSH provides:


A secure and efficient means of remotely accessing your server. We are making it an indispensable tool for system administrators. Developers. Is anyone else tasked with server management?


Throughout this guide, we've explored the fundamental concepts of SSH, how to set up SSH access through cPanel, and best practices for securing your SSH configuration. These recommendations will help you safeguard your server from intrusion, secure sensitive information, and run your hosting service smoothly.


Following the guidelines in this manual will equip you with the knowledge and skills necessary to use and secure SSH access, hence protecting the integrity of your web hosting platform.


Useful links / Resources


  • SSH Access (cPanel Official guide)

  • Download Putty (Official)

  • SSH command basics (Official)

  • Support Article (in Spanish)

  • Support Article (in Portuguese)

  • Go back to Web750