OpenSSH for Windows
Notes from OpenSSH for Windows site -
"OpenSSH for Windows is a free package that installs a minimal OpenSSH server and client utilities in the Cygwin package without needing the full Cygwin installation.
The OpenSSH for Windows package provides full SSH/SCP/SFTP support. SSH terminal support provides a familiar Windows Command prompt, while retaining Unix/Cygwin-style paths for SCP and SFTP."
To setup OpenSSH on a Windows PC follow the instructions below -
-
Extract setupssh.exe from the OpenSSH download and install using default settings - this will install the required files to the C:\Program Files\OpenSSH\ directory.
-
Start a command prompt and enter the following -
CD "C:\Program Files\OpenSSH\bin" [enter]
-
Create a group file -
-
To create a group file (a list of user accounts on the server) for local user accounts, enter the following -
mkgroup -l >> ..\etc\group [enter]
-
To create a group file for domain users edit the above command and replace the -l switch with -d
mkgroup -d >> ..\etc\group [enter]
-
To create a group file for local and domain user run both of the above commands - you will however need to edit the C:\Program Files\OpenSSH\etc\group file in a text editor to remove any duplicate entries.
-
Create a passwd file (it is not possible to login to the server until a passwd file has been created) -
-
To create a passwd file for a local user account, enter the following (where Administrator is the name of the account to create a passwd for) -
mkpasswd -l -u Administrator >> ..\etc\passwd [enter]
-
To create a passwd file for all local user accounts, enter the following -
mkpasswd -l >> ..\etc\passwd [enter]
-
To create a passwd file for a domain user account, enter the following (where domain_username is the name of the domain account to create a passwd for - note from readme file included with the OpenSSH installer "To add domain users from a domain that is not the primary domain of the machine, add the domain name after the user name") -
mkpasswd -d -u domain_username >> ..\etc\passwd [enter]
-
To create a passwd file for all domain user accounts, enter the following -
mkpasswd -d >> ..\etc\passwd [enter]
-
In order to allow login via an encrypted key file the OpenSSH configuration file will need to be edited. To create a backup, open C:\Program Files\OpenSSH\etc\sshd_config in notepad and save as C:\Program Files\OpenSSH\etc\sshd_config.bak.
-
Now replace the text in the configuration file (C:\Program Files\OpenSSH\etc\sshd_config) with the following (use copy and paste - highlight all text in the textbox below and hold the [ctrl]+[c] keys to copy, then [ctrl]+[v] to paste into notepad). See here for changes to the original C:\Program Files\OpenSSH\etc\sshd_config (edited lines are in red) -
-
See here for instructions on creating public and private key files using PuTTYgen.exe.
-
Assuming the instructions were followed in step 7 and PuTTYgen was used to create the keyfiles, copy authorized_keys to the C:\Program Files\OpenSSH\etc\ directory.
-
To start the OpenSSH service, open a command prompt and enter the following -
net start opensshd [enter]