Recently I started playing around with Chef for a project. Chef needs SSH and setting SSH up on Windows is something I've not done before. I couldn't find a set of good instructions so here goes.
- Install and configure FreeSSHd on the server
- Create keys
- configure Putty to connect to the server
- Download FreeSSHd from http://www.freesshd.com/?ctt=download
- Double click to start installer on the server
- As a service
- Accept all other defaults
Open FreeSSHd settings (may have to kill the service and start manually to get the GUI).
- SSH tab:
- Max number = 2
- idle = 600
- Authentication tab
- Pub key folder = C:\Program Files (x86)\freeSSHd\keys
- Password auth = disabled
- Pub key auth = required
- Users tab
- auth = 'Pub key (ssh only)'
- user can use = shell
- click OK
Generate Public and Private keys
- Open PuttyGen
- Click ‘Generate’
- move the mouse pointer around as instructed to generate the key
- Save a Putty compatible private key
- Click ‘Save private key’
- Save this to the client PC, Putty will need this
- You should really save with a passphrase for extra security
- Save OpenSSL compatible private key for Chef knife
- ‘Conversions’ menu > ‘Export OpenSSH Key’ > save as a *.pem
- Save the public key
- Copy the contents of ‘Public key for pasting into OpenSSH authorized file:’ and paste into a textfile.
- rename this file ‘chef’ (no file extension, the filename must match the user login name created above)
- drop this file into the public key folder C:\Program Files (x86)\freeSSHd\keys on the server.
Connecting with Putty
- Open Putty (or Putty portable)
- Enter the IP address of the server
- Connection type = SSH (obviously!)
- In the left menu tree
- Connection > SSH > Auth > ‘Private key file for authentication:’ > click browse
- Select the private key that was generated above
- Click ‘Open’
- when prompted ‘login:’ > enter ‘chef’ > hit enter
- If the private key was saved with a passphrase then enter this when prompted
- You should now be connected to the server.