The tutorial below provides a brief explanation on handling connections over Secure Socket Shell protocol (SSH).
What is SSH Protocol. General Information
- SSH refers to the cryptographic protocol and a suite of utilities such as scp, slogin and ssh which implement the protocol. The protocol provides a strongly encrypted data exchange between two different computers over insecure networks such as the Internet.
- SSH Daemon is included by default on Unix-based operating systems, e.g. Mac OS X, Linux and its derivatives such as Ubuntu, Debian, CentOS, Red Hat, etc. The remote connection on such systems can be established via Terminal application. It is necessary to use the third-party software as an SSH client on Windows operating systems for remote connections, though.
- The protocol supports both public key as well as the password&username based authentications. Unlike VPS and Dedicated servers which allow full control independent of hosting company over SSH connection types, ports, etc., shared, reseller plans allow just the key-based authentication between client and remote operating system.
- The default SSH port is 22, however, hosters would use custom ports for their shared or reseller servers for security reasons. The information about ports as well as other hosting specific data can be found on their help centers.
The below procedures explain how to connect to the remote server by using key-based authentication:
Generating a key pair
1. Log into your hosting cPanel.
2. Locate SSH (usually located under Advanced or Security tab).
3. Click Manage SSH keys, and then Generate New Key.
4. Enter key name as well as password, then click Generate button.
5.The new key will show up under Public and Private keys. Particular hosters will ask you to authorize Public Key. Click Manage next to the key reference, then Authorize.
6. Download Private key.
* There are multiple open-source terminal emulators for Windows. The tutorial covers 3 applications.
This application pair can be used for command line prompt as well as visual file transfers. Putty and WinSCP by default are not supportive of OpenSSH key format which generators initially create. It is necessary to convert it into Putty format:
1. Download and install WinSCP/Putty package: https://winscp.net/eng/download.php
2. Launch PuttyGen application (prepackaged with Putty/WinSCP).
3. Click Load, next to Filename, select all files and load newly-generated key provided by your hosting.
4. The software will prompt you to enter a Pass Phrase. Enter the password you created when generating the key.
5. Click Save Private Key, quit PuttyGen.
6. Launch WinSCP. Under Hostname, enter your server IP address or domain name, SSH Port goes to Port field;
7. Under Username, enter your cPanel username. Paste your Key Passphrase into Password field.
8. Click Advanced below the password field. Open Authentication configurations under SSH tab.
9. Load converted Putty Key. Click OK, then hit Login. The window opening the session might request key passphrase again. The connection is usually established within several seconds.
The software allows you to manage remote computer files visually. To open Command Line Prompt, click Open Session in Putty icon or hit Ctrl+P. It will open a command line prompt and request passphrase for the imported key again:
Type in the key password and hit Enter. Skip Key authentication steps if you are using password&username based SSH authentication.
GitBash is another utility which includes default suite of SSH protocols and can emulate Terminal on Windows operating systems.
1. Download and install GitBash: https://git-for-windows.github.io/
2. Generate a Key pair using instructions above and launch GitBash utility (there is no need to convert the key into Putty format now).
3. Use SSH command with -i flag to SSH into remote server; Specify username (usually cPanel username), hostname (or server IP address) as well as port in the command, example:
4. You will be requested to type in a key passphrase. Once entered, application will establish connection.
5. Skip -i flag along with key file path if you are using plain password&username based connection.
[notice type=”warning”]Important! Windows operating systems use Backward Slash in their hierarchical file system. Make sure to use Unix Forward Slash when specifying the path to the key file in GitBash command line prompt.
[notice type=”111″]SiteGround hosting: