PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. PowerShell now comes included with Windows and can be used to connect to a server using SSH. This guide will explain the steps to get connected to a shared server using SSH in Windows PowerShell.
Related Article
What to do or how to resolve:
- Log into cPanel
- Generate and Authorize a Pair of SSH Keys
- Navigate to SSH Access, under Security
- Click on Manage SSH Keys
- Scroll down to Private Keys
- Locate the private key which was generated in Step 2. Click View/Download
- Click Download Key
- Save the key file to your Desktop
NOTE: By default, the file will be named id_rsa and will not have an extension. - Open the Run dialog using the <Windows Key + R> shortcut key
- Enter
%USERPROFILE%\.ssh
into the Open field and click OK - Copy the id_rsa key file from your Desktop into the .ssh folder that was opened
- Right-click on the background of the .ssh folder and select New and then select Text Document from the context menu
- Select the entire name of the text document (including the .txt extension) and rename it to
config
and press Enter - Right-click on the config document and select Open With
- Select Notepad and click OK
- Enter the following information into the notepad
Host [MyWebsite] HostName domain.com Port 2222 User userna5 IdentityFile ~/.ssh/id_rsa
REPLACE:
Replace [MyWebsite] with any short name that you can remember.
Replace domain.com with your domain or the account's hostname, found in Account Technical Details.
Replace userna5 with your cPanel username. - Save and close the file
- Open a new Command window using <Windows Key + R> and entering
PowerShell
into the Open field. Click OK or Press <Enter> - At the command prompt, enter
ssh [MyWebsite]
REPLACE: Replace [MyWebsite] with whatever you used in the Host line above. Please be aware it is case sensitive. - If prompted to continue connecting, type
yes
and press <Enter> - Enter the passphrase for the id_rsa key when prompted
NOTE: When entering the password, no characters will be displayed. This is normal. The password is still being typed. - If successful, the cPanel username and server will be displayed
EXAMPLE:PS C:\Users\testuser> ssh IMHServer
The authenticity of host '[ehub58.webhostinghub.com]:2222 ([199.250.218.13]:2222)' can't be established.
ECDSA key fingerprint is SHA256:BKUrtUjsHV+***************UhfZ1FpAPvNskJW0J8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[ehub58.webhostinghub.com]:2222' (ECDSA) to the list of known hosts.
Enter passphrase for key 'C:\Users\testuser/.ssh/id_rsa':
[userna5@ehub58 ~]$