SSH from Windows

From Newroco Tech Docs
Revision as of 13:08, 8 April 2020 by Lucian.pricop (talk | contribs) (Created page with "More information about SSH key authentication can be found here. This article is addressed to Windows users and assumes that you already have your VM properly...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

More information about SSH key authentication can be found here.

This article is addressed to Windows users and assumes that you already have your VM properly set up to use keys instead of passwords, if you don't then read here.


What to install

You need to install the latest stable versions of each of the following software:

  • pagent from here [1] - this is necessary to enable key forwarding for putty
  • putty from here [2] - this gives you console access to the machines

Configuring putty

With putty you add connection sessions. In order to connect to newroco internal machines you need to connect to our Asterix machine first and then to our gateway machine

  • Set up a new connection by typing in the "Host name (or IP address)" box <username>@93.188.176.18 - IP subject to change, ask DevOps what the IP is in case this one doesn't respond any more.
  • Fill in the port: 22.
  • Connection type must be set to SSH.
  • Go to SSH menu item in the left tree view and for Remote command type or paste "ssh nrc-gateway"
  • Expand the SSH sub menu
  • Go to Auth sub menu and for "Authentication parameters", tick both "Allow agent forwarding" and "Allow attempted changes of the username in SSH-2".
  • Click on the browse button to select the file that contains your private SSH key.
  • Now go back to the sessions view by clicking the Session menu item in the tree view, type a name for the session something like "@newrocoAsterixGateway" and click on Save.

To SSH onwards to a second server, you will need to use pageant to forward your private key from your windows box to the next server.

Configuring pageant

Pageant is an SSH authentication agent for putty and is crucial for key forwarding to work. Create sessions in putty as described above, ensuring that you enable the "Allow agent forwarding" and point to the location of your private key file.

  • Double-click pageant.exe to start the program. You'll notice a PC with a fedora hat icon in your tray bar.
  • Right click and you'll see the contextual menu. Use "add key" to add your private key (generated using puttygen and saved as a .ppk file).
  • When you do this you'll be asked to provide the passphrase for that key.
  • Create a new session (from the right-click menu) or choose one of your putty saved sessions.

After you add the key, when you connect to a machine that asks for that key, you don't need to type the password again.

For convenience, if you want pagent to start when windows starts hold windows key and press R, now type or paste "shell:startup". On this window create a new shortcut to pageant. If you want it to add automatically a specific key, edit the properties of that file and change the target by adding the path to that SSH key right after the existing target path:

"<path to pageant.exe>" "<path to your SSH ppk key>"