How to connect to SSH using Command Prompt in Windows?

You need to use key-based authentication in your SSH/SFTP client (the software you are using to connect, e.g., Putty or FileZilla) to connect to SSH/SFTP. Contact us to enable SSH for your hosting account (not needed for VPS and Dedicated Server), and then follow this guide.

Note:
Commands run via SSH can cause irrecoverable damage to your server or hosting account. We strongly recommend that only users with prior experience use SSH.

 

Step 1: Generate Public and Private Keys in Windows


  • Install "OpenSSH Client" from Start Menu > Apps & Features > Optional Features> Add a feature.

    No need to install if "OpenSSH Client" is already installed in "Optional Features".

  • Run the "Command Prompt" (open the Start Menu and type "cmd") app and execute the following command:

    ssh-keygen -t rsa

  • It will ask you to save your keys to C:\Users\username/.ssh/id_rsa. Press Enter.

  • It will ask for a passphrase. Leave it empty.

    Press Enter, and then press Enter again.

  • Execute the following command to view the public key:

    type .ssh\id_rsa.pub

    Copy the public key (select the text and right-click to copy or press Shift + Enter).

  • Done!

 

Step 2: Authorize the Public Key


You need to authorize your public key to connect to SSH or SFTP.

How to authorize your public key in cPanel and DirectAdmin?

 

Step 3: Connect to SSH Using Command Prompt in Windows


  1. Run the "Command Prompt" (open the Start Menu and type "cmd") app and execute the following command:

    ssh -p 2022 username@server.example.com

    *Replace username with your cPanel/DirectAdmin username.
    *Replace username with root if you are connecting to a VPS/Dedicated Server as the root user.
    *Replace server.example.com with your server hostname or IP address.

  2. Type in yes and press Enter if it asks, "Are you sure you want to continue connecting?".

  3. Done!

 

Terminal in cPanel/WHM


cPanel and WHM allow using SSH without the need for a key pair:

cPanel: Go to cPanel > Advanced > Terminal
WHM (VPS/Dedicated Server with root access): Go to WHM > Server Configuration > Terminal.

 

  • 229 Users Found This Useful
Was this answer helpful?

Related Articles

How to limit the number of FTP connections?

When uploading a large number of files, we recommend you limit the number of FTP connections....

How to upload a large number of files quickly via FTP or File Manager?

Uploading a large number of times usually takes a lot of time. Your computer and server traverse...

How to enable and access SSH?

SSH remains disabled by default on all hosting accounts (excluding VPS and Dedicated Server). If...

How to connect to SSH from Mac?

SSH access must be enabled for your hosting account (excluding VPS and Dedicated Server) to...

How to authorize your public key in cPanel and DirectAdmin?

cPanel and DirectAdmin provide a seamless interface to authorize your public key. Authorizing the...