1

I had to create a Virtual Machine with Windows Server 2012. Now I want to connect to it via OpenSSH and Bash, installing OpenSSH is successful, however when I connect to the server via ssh Administrator@<ip> I can only use the Windows Powershell. Is it possible to install a bash (like git bash or cygwin) and to connect via ssh directly to this shell ?

  • 2012 foundation ? – yagmoth555 Jun 22 '16 at 19:36
  • Windows Server 2012 Standart 64-bit (German) – mac.1 Jun 23 '16 at 9:45
2

You want to use Cygwin, then use Cygwin, right? A big limitation with my instructions is that it's for a single user at a time, SSH isn't running as a service. Hopefully someone can provide an answer to get it working as a service.

Download the installer setup-x86-64.exe and run it.

You need these packages:

  • cygrunsrv
  • openssh
  • openssl
  • rsync
  • xinit
  • xorg-docs
  • xorg-server

After Cygwin is installed, run the "Cygwin64 Terminal" as Administrator.

ssh-host-config

Should privilege separation be used? (yes/no) yes

new local account 'sshd'? (yes/no) yes

Do you want to install sshd as a service? (Say "no" if it is already installed as a service) (yes/no) no

Give your user ownership of their SSH directory:

chown username /var/empty /etc/ssh*

Edit the sshd configuration file:

vi /etc/sshd_config

Allow the SSH environment file to be used for non-interactive sessions:

PermitUserEnvironment yes

You need a login script to start sshd every time, I lazily created sshd.bat and copied it to shell:common startup

@echo off

REM # Start SSH server, as a regular process.  Use /var/log/sshd.log instead of
REM # Windows Event Log
C:\cygwin64\bin\run -p C:\cygwin64\bin /usr/sbin/sshd -D -E /var/log/sshd.log

Improvements welcome!

1

https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

The link above says this is just available on latest Windows 10 version:

Your PC must be running a 64-bit version of Windows 10 Anniversary Update build 14393 or later

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.