A secure shell (SSH) is used for secure communication between devices. When most people refer to SSH, it is within the context of a connecting from a local computer to a remote server, commonly for administration tasks related to website hosting. Show
This article walks you through how to use SSH from Windows, covering the basics of installing a Windows SSH command-line tool and connecting to a remote server (such as a Linode) over SSH on a local Windows system. Before You Begin
Open the TerminalOn your local Windows computer, open the terminal application you wish to use. The terminal allows you to access your operating system’s shell environment and run programs through the command line, such as the SSH command.
Command Prompt (or PowerShell) - Windows 10 or 11There are two terminals on Windows 10 and 11, the Command Prompt (also called CMD) and PowerShell. To connect to a server using SSH on Windows 10 within one of these tools, the OpenSSH client needs to be installed. OpenSSH is a Windows SSH client and available on newer versions of Windows 10 (April 2018 update and later), though it may need to be manually enabled. Install the OpenSSH Client
Open the Command Prompt or PowerShellTo run the SSH command, you first need to open your preferred command line utility. Open Windows Search through the Windows + S hotkey, type “Command Prompt” or “PowerShell” into the search area, and select the corresponding application from the results. PowerShell 7 or later, the newer cross-platform PowerShell application, can also be used if installed. Windows Subsystem for Linux (WSL) - Windows 10 or 11Instead of using the Command Prompt or PowerShell environment (which is significantly different than both the macOS and Linux command-line environments), you can run Linux directly within Windows through WSL (Windows Subsystem for Linux). This may be preferred if you are more comfortable working within a Linux shell environment.
Once everything has been configured, you can use the WSL environment by opening your installed Linux distribution through the Start Menu or Windows Search. By default, WSL uses a fairly basic terminal emulator. You can also use a more customizable terminal, such as Windows Terminal or Hyper. PuTTY - Windows 8, 7, Vista, and XPThere is no native SSH client in Windows 8 and earlier. Instead, you’ll need to use a third party application, such as PuTTY, Cygwin, the Secure Shell extension for Google Chrome, or any other SSH-enabled terminal emulator:
Connecting to the Remote Server Over SSH from WindowsOnce you’ve opened
your preferred Windows SSH client (Command Prompt, PowerShell, or WSL), you can run the
Once you have successfully connected, your terminal should be using the remote shell environment for the server. Your command prompt should
now show the username and hostname configured for the server. You can now run any commands that you have available on that server. This includes many of the basic Linux commands, such as Ending the SSH SessionAfter you are done, log out of the session by typing
At this point, the shell prompt returns to the one for the local workstation and the terminal application can be closed if it’s no longer needed. Sending Commands Over SSHInstead of using SSH to open your remote server’s console, you can run commands on your server without leaving your local shell environment. This can enable you to quickly run commands both locally and remotely in the same terminal window. Sending a Single CommandTo run a single command on your remote server, use the following command. Replace [username] with the username of the remote user, [ip-address] with the IP address or domain name of the remote server, and [command] with the command you wish to run.
As an example, running Sending Multiple CommandsTo run multiple commands on your remote server (one after the other), use the following command. Replace [command-1], [command-2], and [command-3] with the commands you wish to run.
The commands should be separated by a semi-colon ( Using sudoIt’s recommended to disable root access over SSH and only log in to your remote server through a limited user account. However, some commands require elevated privileges, which can usually be accomplished by prepending the command with Going FurtherTroubleshooting SSH Connection IssuesIf SSH isn’t connecting you to your Linode, you may need to investigate the state of your server. See the guide Troubleshooting SSH for assistance. Increasing Security
This page was originally published on Friday, June 25, 2021. Which command is used for accessing a machine remotely?The ssh command is used from logging into the remote machine, transferring files between the two machines, and for executing commands on the remote machine.
What is SSH used for?SSH or Secure Shell is a network communication protocol that enables two computers to communicate (c.f http or hypertext transfer protocol, which is the protocol used to transfer hypertext such as web pages) and share data.
How do I connect to a remote computer using SSH?SSH uses port 22 by default, but you can change this to a different port. To initiate an SSH connection to a remote system, you need the Internet Protocol (IP) address or hostname of the remote server and a valid username. You can connect using a password or a private and public key pair.
How do I SSH with a username and password?How to Connect via SSH. Open the SSH terminal on your machine and run the following command: ssh your_username@host_ip_address. ... . Type in your password and hit Enter. ... . When you are connecting to a server for the very first time, it will ask you if you want to continue connecting.. |