When working on Cpanel server, sometimes you need SSH(secure shell) access for project. SSH allows you to direct access to web server from command line interface. Your connection via SSH is encrypted allowing the secure connection. With SSH access, user can transfer files with server, modify and run shell script.
This article provides details about how to connect to web server via the SSH.
Configure to SSH access in cPanel
Many hosting provider offers SSH access with cPanel. You can check if your hosting provider offers SSH access from your cPanel dashboard. If your hosting provider offers SSH access, then first you need to generate public key and private key.
For that first login to your cPanel account and go to the Security section. Under security section click on SSH Access option.
On new page, click Manage SSH Keys button.
Then click on Generate a New Key button.
If you have already generated an SSH public/private key pair, then you can also import. Here we are generating new keys. After you click Generate a New Key button, you will redirected to bellow form page to generate Public Key. For that input key name. Default value may be "id_rsa". You can change it or remain it as default value. Enter Key password and other inputs and click Generate Key button.
You get message that Key generation complete.
Now click Go Back link and you will see Public key and Private key in the the list. You need to authorise Public key to use. So click on Manage link in Public key.
Now click on Authorize button.
Now your server configuration is complete. The Public key is stored in server whereas Private Key is stored in local msystem. When you attempt to login to a server, the public and private key are compared. If they match, then you will be allowed to login to the server location.
Configure in Local system
For Windows system, you need SSH client software PuTTY. Open PuTTY application.
Put Host Name or IP address. In the port field enter 21098 for shared server or 22 for a VPS/Dedicated server. In the Connection Type, choose SSH and press the Open button.
You will get PuTTY Security Alert, in that box press Ok. Then it will open CMD Prompt. Now enter server Username and Password. It will connect to remote server via SSH.
Linux/ Mac OS
For Linux or Mac OS, you do not need to install third party application, you can directly access remote server from your Terminal. You need to set Private Key in your local system. Download Private Key file named id_rsa from cpanel and put this file at ~/.ssh folder in your system.
Now open Terminal and run bellow command with your own server username and server. Use port as 21098 for shared server or 22 for a VPS/Dedicated server.
ssh user@server -pPort
If the connection is first time, it will ask for confirmation. Type yes and press ENTER. Last it will ask for user Password. Input password and hit ENTER. It will connect remote server.
This way you can connect your remote server with SSH access. I hope this article helps you to connect remote server via SSH. If you have any questions or suggestions, do let me know in the comment section below.