Help:Putty

From Wikitech
Jump to: navigation, search


This page describes the use of PuTTY on windows for accessing Labs instances.

Download the software

The download page is on http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Download PuTTY, Pageant and PuTTYGen. You can also download PSCP or PSFTP, if you want to transfer files from your computer to Labs directly (if you're not using a publicly accessible repository or a web server).

Generating a key pair

  • Open PuTTYGen.exe and click “Generate”.
  • Select “RSA SSH-2”, “2048 bits” and click “Generate”.
  • Move your mouse randomly while the progress bar indicates that PuTTYGen is collecting randomness out of your mouse movements. Then wait for it to generate the key.
  • You then can enter a comment (in the form of user@host) if you want access Labs from more than one computer.
  • You should enter a passphrase to secure your key (twice). If you don't, your Labs account could easily be compromised.
  • Click “Save private key” and save your key to a location you remember.
  • Copy the public key to your preferences and click “Save”.

See also http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter8.html#pubkey-puttygen.

Setting up your session

  • Open PuTTY and enter “bastion.wmflabs.org” into host name on the Session category (this is what you see when you open PuTTY)
  • Open the category Connection → SSH → Auth, check “Allow agent forwarding” and specify your private key file in the according text field.
  • Go back to the Session category, type “Labs” (or anything you want to) into the text field labeled “Saved Sessions” and click “Save”.

See also http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter4.html.

Connecting to your instance

  • Open Pageant.
  • Right-click on the Pageant tray icon (a computer wearing a hat) and click “Add key”. Select your private key file and click “Open”.
  • Enter your passphrase.
  • Open PuTTY and select your Labs session, click on “Load” and “Open”.
  • Type “ssh <your-instance>”.

You can combine the last two steps if you write the mentioned command into the text field labeled “Remote command:” in the Connection → SSH category (don't forget to save your session).

See also http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter9.html.

Copying files from your computer to Labs via the command line

You can use PSCP or PSFTP. Both are run from the command line (type Win+R, “cmd” and hit return or look into the programs section of your start menu). Before you run, you have to ensure that you are in the directory where you have downloaded your executable.

PSCP

pscp <file> [<file> …] <session>:

See also http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter5.html.

PSFTP

psftp <session>

Available commands:

  • lpwd to check if you are in the directory of the files you want to transfer.
  • lcd to change your local working directory.
  • put <file> to upload your file.

See also http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter6.html.

Moving your files from bastion to your instance

On bastion (PuTTY, not PSFTP), type:

scp * <instance>:[<path>]
rm *