SSH (Secure Shell) is an encrypted network protocol that is used for connecting to devices over a network or the internet. Linux computers generally house a preinstalled SSH tool that can be accessed with a terminal command, however, what about Windows?
Yes, Windows does have a built-in SSH client that you can use in Windows Terminal. This article will teach you how to set up a profile in Windows Terminal that uses SSH.
Access Windows SSH Client
The latest versions of Microsoft, i.e., Windows 10 and Windows 11 include a built-in SSH server and client that are based on OpenSSH, a connectivity tool for remote sign-in that use the SSH protocol. OpenSSH encrypts all traffic between the client as well as the server to eliminate eavesdropping, and connection hijacking, among other attacks.
By default, the OpenSSH client is located in the directory: C:\Windows\System32\OpenSSH. You can check to see if it is installed by navigating to Windows Settings > Apps > Optional features, then search for “OpenSSH” in the installed features.
Create a profile
You start an SSH session in your command prompt by executing ssh [email protected], then you will be prompted to enter the password. You have the ability to create a Windows Terminal profile that does this on startup by adding the command line setting to a profile in the settings.json file inside the list of profile objects.
“name”: “[email protected] ssh profile”,
“commandline”: “ssh [email protected]”
Specify starting directory
If you want to specify the starting directory for an ssh session invoked by Windows Terminal, you need to use this command:
“commandline”: “ssh -t [email protected] \”cd /data/bob && exec bash -l\””
The -t flag is to force the pseudo-terminal allocation. This allocation can be used to execute arbitrary screen-based programs on a remote machine, for example, when implementing menu services. You have to use escaped double quotes because bourne shell derivatives do not do any additional parsing for a string in single quotes.
If you liked this article (or if it helped), leave a comment below or share it with friends so they can also know How to SSH on Windows?