This is going to be a super quick tutorial about how to access a Windows environment through ssh.

Step 1. Install cygwin, and make sure openssh and cygrunsrv packages are installed:

Make sure openssh is selected for installation

Make sure cygrunsrv is selected for installation

Step 2. Start cygwin and run ssh-host-config to configure ssh:

Run ssh-host-config to configure ssh

Step 3. Run cygrunsrv -S sshd to start sshd as a Windows service:

Run cygrunsrv -S sshd to start sshd

Step 4. Ssh into Windows using your favorite ssh client

Use putty to ssh into Windows

You can even set this up for your local workstation (if it happens to be Windows). Then you can forget about cmd.exe or PowerShell and use a real shell locally. Until next time.


January 27, 2014, 19:16

Another alternative that I would recommend is 'BitVise SSH Server'. It is free for personal use, but, unfortunately, not open source. By default, it is configured to run as a service at startup. I can even SSH to a freshly booted machine and log in using the SSH shell (I use mRemote / mRemoteNG [ ] on the other side to access the SSH clients -- With its tabbed interface, it is easy to deal with multiple machines simultaneously).

January 27, 2014, 22:20

Thanks for the comment, didn't know about BitVise SSH Server and mRemote. Very useful!

Chris Permalink
January 27, 2014, 21:24

Why would you use SSH on a Windows server?

January 27, 2014, 22:19

Well to remotely manage the server though ssh and to deploy updates through ssh, and transfer files very quickly through scp, as well as having a better shell!

Chris Permalink
January 30, 2014, 01:32

I am not saying there is anything wrong with SSH, just that most all management of Windows can be done with PowerShell, remotely and securely...

And for secure file transfer you could enable Secure FTP which is also built-in and configurable through PowerShell...

March 26, 2014, 15:06

For us folks that are comfortable with the bash shell, this makes working in Windows from putty or a *nix host quite convenient. Powershell has its uses, but it really isn't any more secure than scp. And, IMHO, establishing sessions with the more secure public/private rsa keys via ssh-keygen is a lot easier than having to deal with Kerberos, CredSSP or certificate.
Technet article discussing WinRM and Powershell for remote management:

Foo Permalink
January 28, 2014, 15:25

Because this particular windows machine is the only one *you* can access that can access another (linux) server through ssh? That's a real use case even if that seems a bit weird.

So with this you can ssh into windows, and then ssh into the 'target' server.

Otherwise you'd have to remote desktop into the windows machine, and then ssh from there into the target server.

Chris Permalink
January 30, 2014, 01:34

Sounds like you want to explore Remote Desktop Gateway which is included for free in Windows Server...

Nick Permalink
January 28, 2015, 01:45

Honestly, I'm using it so I can connect to my raspberry pi(s) connected to the LAN of my desktop from my laptop anywhere

no_name Permalink
March 01, 2014, 11:40

I actually do the other way round; I got cygwin on my wintel box and from it I ssh/scp/sftp etc to UNIX boxes. Sshd/cygwin on wintel is nice if you need to admin wintels with strong UNIX background.

Christopher Permalink
October 30, 2014, 03:17

Why do you allow links in your comments?

Leah Permalink
September 12, 2017, 20:40

This is an awesome find for me! I wish I had found this a few years ago. We're in a test environment, so we use remote desktop to login to our Windows server. I've been looking for another way in for years. Neat!

September 10, 2018, 07:29

This way has been the government, and secure windows standard for a long time. If the government mandates Putty over say Powershell to use and access their machines and servers then there must be something to it. I'm not a big Powershell user. I use cmd frequently, I grew up on Windows, love windows, but nothing beats the linux and mac Terminals period. Sure, filezilla gui's for sftp are okay but annoything. I want direct admin access and be able to zoom through it on a bash session. This is the reason I choose and the government may have their own reasons, i would imagine security plays into it more than anything. My first experience with it was 3+ years ago as a gov contractor doing MVC when Ember and Angular were white hot. Got brought in to do which turned out well but was so slow in the making due to having to ssh in and I always forgot so i wasn't on the domain and network, I learned the hard way lol I thought it was pointless then, now after choking out a hack mid-hack i thought I ought to up my secure standards.. This was a considered option for my windows network. I've tried Bitvise but not a fan, not like someone could ever be a fan of Putty but puttygen and putty paegent are the way to go. It's been around, it's solid. I highly recommend if you have to make outbound remote connections or allow inbound remote connections on a server or machine.

Leave a new comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "coding_407": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.