Inhaltsverzeichnis

Cygwin

Installation

Become admin and install for all users

http://ftp.inf.tu-dresden.de/software/windows/cygwin32/ and http://ftp.gwdg.de/pub/linux/sources.redhat.com/cygwin/ are good mirrors for Germany.

Run sshd

Install OpenSSH with the Cygwin installer.

Start cygwin bash shell with right mouse click as an administrator. (It is not enough to be logged into Windows as an administrator)

Run ssh-host-config, answer yes to all questions, and when prompted to „Enter the value of CYGWIN for the daemon“, enter 'ntsec', which enables communication with the NT authentication database. Source

Among others this creates new non-privileged account „sshd“ and a new privileged accound „cyg_server“ http://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1 might be useful to understand what is going on

After that, sshd can be started with cygrunsrv -S sshd and you may log in from remote via ssh with normal windows username and password.

Changing the Home Directory

Edit the home path of the user in /etc/passwd

At least since 2011-02-09 /etc/passwd doesn't contain concrete users any more. The home dir is determined from the $HOME einvironment variable. Therfore IMHO It is better to tweak $HOME in /etc/profile below the user name detection, eg:

# Set the user id
USER="`id -un`"
export USER
 
# insert something like this:
HOME="/cygdrive/d/$USER"
export HOME

See also FAQ

PHP Integration

Probably obsolete, PHP is now part of Cygwin — 2016-02-12 11:57

This section is about using PHP from the cygwin command line, not for dynamic web pages. Because PHP is not included in Cygwin, the windows version of PHP has to be installed separately. In order to call a PHP script from the Cygwin command line, you need some glue:

#!/bin/bash
# Filename: /usr/bin/php
# Purpose: Enable calling of PHP scripts from cygwin command line
# When a PHP script is called from Cygwin-bash, bash reads the first line of
# the PHP script which must be "#!/usr/bin/php". Then it calls this script
# and passes the location of the PHP script as first argument in unix format.
# This script then converts the unix pathname to the appropriate windows
# pathname and calls php.exe with the PHP script location as first argument.
 
PHP=/cygdrive/d/usr/php/php.exe # Set this to the location of your php binary!
 
phpScript=$(cygpath -w $1)
shift
$PHP "$phpScript" "$@"

Start Shellscripts directly

To start shellscripts from the windows environment, e.g. from Explorer or a desctop icon, register the bash-file type and make the following entry in the open-action:

"C:\cygwin\bin\bash.exe" "%1" "%2" "%3" "%4" "%5" "%6"

This allows 5 command line arguments to be passed.