Installing OpenSSH on Windows via Chocolatey
-
Microsoft has been working on porting the OpenSSH SSH client and server packages to Windows and has made the package available via Chocolatey! The package is known as win32-openssh. This is super, duper exciting - both that they have gotten these packages available and that they are working with Chocolatey packaging to make this as easy as possible for users.
This OpenSSH port is open source and includes both client and server components. That means that you can install the client tools and use these on Windows instead of using a third party tool, such as PuTTY. You can use native ssh commands directly from inside of a Windows shell session. Having an SSH server means that we can remote into a Windows machine directly from every other OS (they all have native SSH these days except for Windows) and execute PowerShell the same way that we use Bash on Linux, for example. Unified management, so handy.
Installing the client components is incredibly easy. Assuming that Chocolatey is already installed, from our PS prompt we just run:
choco install win32-openssh
That's it. Reload your shell environment and you can ssh directly into any available server just as if you were on Mac OSX, Linux, BSD or whatever.
Now to install the SSH Server (or SSHD in UNIX terminology, the "d" standing for daemon) on Windows instead we would use the following commands:
choco install win32-openssh -params '"/SSHServerFeature /KeyBasedAuthenticationFeature"' Restart-Computer
The reboot is necessary, but it we look at a screenshot of the installation process, we can see that the Chocolatey installer is not just installing our OpenSSH server package, but that it is also setting the service to start automatically and modifying the Windows firewall to open port 22 (the SSH port) so that we are able to use the service right away. We need to reboot for this to take effect, however.
-
top running on an SSH session from PowerShell to a remote Linux Mint host.
-
@scottalanmiller Thanks. I installed this via chocolately. How do I discover the OpenSSH commands so i can use them?
-
@scottalanmiller said in Installing OpenSSH on Windows via Chocolatey:
Installing the client components is incredibly easy. Assuming that Chocolatey is already installed, from our PS prompt we just run:
Chocolatey is designed to run from an elevated command prompt, not PowerShell. Obviously you can still execute basic shell commands from PowerShell also, but it is in no way required.
-
@alex.olynyk said in Installing OpenSSH on Windows via Chocolatey:
@scottalanmiller Thanks. I installed this via chocolately. How do I discover the OpenSSH commands so i can use them?
I only know of ssh and sftp being ported.
-
@scottalanmiller Thanks. I got it. I overthink everything.