How to SSH to your server from Windows, macOS, or Linux
In this post, we are going to share a guide on connecting your server via SSH from any OS like Windows, Mac or Linux. Let’s have a look on Connecting via SSH to your server.
Connect via SSH from Windows
Windows still don’t offer a built-in SSH command. Microsoft announced that they will support SSH using PowerShell in Windows 10. Now Microsoft has a good solution for this, there is a third party solution called Posh-SSH. It’s a third party module for Powershell. To use SSH in PowerShell you first have to install the Posh-SSH PowerShell Module from the PowerShell Gallery. Make sure you are running Windows 10 or you have the Windows Management Framework 5 installed. However, still, the most popular and widely recommended solution for connecting to SSH servers is an open source, a third-party application called PuTTY.
Download PuTTY and launch it to get started. You can download either an installer that included PuTTY and related utilities. or a putty.exe file that can function as a portable application.
Type the host name or IP address of the SSH server into the “
Hostname (or IP address)” box. Ensure the port number in the “
Port” box matches the port number the SSH server requires. SSH servers use port 22 by default, but servers are often configured to use other port numbers instead. Click “Open” to connect.
You’ll see a security alert the first time you try to connect to a server. This tells you that you haven’t previously connected to this server. That’s expected, so click “OK” to continue.
You’ll be prompted to enter the username and password for your account on the SSH server. After you do, you’ll be connected. Just close the window to end the SSH connection.
Connect via MacOS and Linux
UNIX-based operating systems like macOS and Linux include a built-in SSH command that works pretty much the same everywhere. You can even use this command on Windows 10 via the Bash on Windows environment.
To connect to an SSH server from one of these operating systems, first, open a terminal window. On a Mac, you’ll find this at Finder > Applications > Utilities > Terminal. On a Linux desktop, look for a Terminal shortcut in the applications menu. On Windows, install and open the Bash shell.
To connect to an SSH server, type the following command into the terminal, replacing
username with your username on the SSH server and
ssh.server.com with the hostname or IP address of the SSH server:
This command will connect to the SSH server on port 22, which is the default. To specify a different port, add
-p to the end of the command followed by the port number you want to connect on, like so:
ssh firstname.lastname@example.org -p 2222
You’ll see a message asking you to confirm the identity of the server the first time you connect. If this is actually the first time you connected to the server, this is normal and you can type “
yes” to continue.
You’ll by prompted to type the password the user account requires on the SSH server before continuing. Once you have, you’ll be connected. Close the window or type “exit” and press Enter to end the SSH connection.
You’ll find more information on using the ssh command in the SSH manual page. You can access it by typing
man ssh at the terminal, or by viewing it in your web browser.