| 1 | \versionid $Id: plink.but,v 1.7 2001/08/04 13:06:08 simon Exp $ |
| 2 | |
| 3 | \C{plink} Using the command-line connection tool Plink |
| 4 | |
| 5 | \# Explain Plink |
| 6 | |
| 7 | \# Explain that Plink is probably not what you want if you want to |
| 8 | \# run an interactive session in a Command Prompt window |
| 9 | |
| 10 | \# Explain that Plink is really for batch-file use, and that |
| 11 | \# therefore it works best with public-key authentication; link to |
| 12 | \# that chapter |
| 13 | |
| 14 | \# Give instructions on how to set up Plink with CVS |
| 15 | |
| 16 | \i{Plink} (PuTTY Link), is a command-line connection tool similar to |
| 17 | UNIX \c{ssh}. It is probably not what you want if you want to run an |
| 18 | interactive session in a console window. |
| 19 | |
| 20 | \H{plink-starting} Starting Plink |
| 21 | |
| 22 | Plink is a command line application. This means that you cannot just |
| 23 | double-click on its icon to run it and instead you have to bring up a |
| 24 | \i{console window}. With Windows 95, 98, and ME, this is called an |
| 25 | \q{MS-DOS Prompt} and with Windows NT and 2000 it is called a |
| 26 | \q{Command Prompt}. It should be available from the Programs section |
| 27 | of your Start Menu. |
| 28 | |
| 29 | To start Plink it will need either to be on your \i{\c{PATH}} or in your |
| 30 | current directory. To add the directory containing Plink to your |
| 31 | \c{PATH} environment variable, type into the console window: |
| 32 | |
| 33 | \c set PATH=C:\path\to\putty\directory;%PATH% |
| 34 | |
| 35 | This will only work for the lifetime of that particular console |
| 36 | window. To set your \c{PATH} more permanently on Windows NT, use the |
| 37 | Environment tab of the System Control Panel. On Windows 95, 98, and |
| 38 | ME, you will need to edit your \c{AUTOEXEC.BAT} to include a \c{set} |
| 39 | command like the one above. |
| 40 | |
| 41 | \H{plink-usage} Plink Usage |
| 42 | |
| 43 | Once you've got a console window to type into, you can just type |
| 44 | \c{plink} on its own to bring up a usage message. This tells you the |
| 45 | version of Plink you're using, and gives you a brief summary of how to |
| 46 | use Plink: |
| 47 | |
| 48 | \c Z:\sysosd>plink |
| 49 | \c PuTTY Link: command-line connection utility |
| 50 | \c Release 0.50 |
| 51 | \c Usage: plink [options] [user@]host [command] |
| 52 | \c Options: |
| 53 | \c -v show verbose messages |
| 54 | \c -ssh force use of ssh protocol |
| 55 | \c -P port connect to specified port |
| 56 | \c -pw passw login with specified password |
| 57 | |
| 58 | \S{plink-usage-basics} The basics |
| 59 | |
| 60 | \S{plink-usage-options} Options |
| 61 | |
| 62 | These are the command line options that Plink accepts. |
| 63 | |
| 64 | \S2{plink-usage-options-v}\c{-v} show verbose messages |
| 65 | |
| 66 | By default, Plink only displays any password prompts and the output of |
| 67 | the remote command. The \c{-v} option makes it print extra |
| 68 | information about the connection being made, for example: |
| 69 | |
| 70 | \c Server version: SSH-1.5-OpenSSH-1.2.3 |
| 71 | \c We claim version: SSH-1.5-PuTTY |
| 72 | \c Using SSH protocol version 1 |
| 73 | \c Received public keys |
| 74 | \c Host key fingerprint is: |
| 75 | \c 1023 e3:65:44:44:bd:b1:04:59:bc:e2:3d:a1:4d:09:ce:99 |
| 76 | \c Encrypted session key |
| 77 | \c Using 3DES encryption |
| 78 | \c Trying to enable encryption... |
| 79 | \c Successfully started encryption |
| 80 | \c Sent username "fred". |
| 81 | \c Sent username "fred" |
| 82 | \c fred@example.com's password: |
| 83 | |
| 84 | This information can be useful for diagnosing problems. |
| 85 | |
| 86 | \S2{plink-usage-options-ssh}\c{-ssh} force use of ssh protocol |
| 87 | |
| 88 | \S2{plink-usage-options-P}\c{-P port} connect to specified port |
| 89 | |
| 90 | \S2{plink-usage-options-pw}\c{-pw passw} login with specified password |
| 91 | |
| 92 | \H{plink-pubkey} Using public key authentication with Plink |
| 93 | |
| 94 | \H{plink-batch} Using Plink in \i{batch files} and \i{scripts} |
| 95 | |
| 96 | \H{plink-cvs} Using Plink with \i{CVS} |
| 97 | |
| 98 | To use Plink with CVS, you need to set the environment variable |
| 99 | \c{CVS_RSH} to point to Plink: |
| 100 | |
| 101 | \c set CVS_RSH=\path\to\plink.exe |
| 102 | |
| 103 | You also need to arrange to be able to connect to a remote host |
| 104 | without a password. To do this, either: |
| 105 | |
| 106 | \b Run PuTTY, and create a PuTTY saved session (see \k{config-saving}) |
| 107 | with the protocol set to SSH (see \k{config-hostname}) and specifies |
| 108 | your private key file (see \k{config-auth}). You will probably also |
| 109 | want to specify a username to log in as (see \k{config-username}). |
| 110 | You should then be able to run CVS as follows: |
| 111 | |
| 112 | \c cvs -d :ext:user@sessionname:/path/to/repository co module |
| 113 | |
| 114 | If you specified a username in your saved session, you can just say: |
| 115 | |
| 116 | \c cvs -d :ext:sessionname:/path/to/repository co module |
| 117 | |
| 118 | Alternatively, you can use Pageant if Pageant is running (see |
| 119 | \k{pageant}). To do this, you would: |
| 120 | |
| 121 | \b Ensure Pageant is running, and has your private key stored in it. |
| 122 | |
| 123 | \b Set the environment variable \cw{PLINK_PROTOCOL} to the string |
| 124 | \c{ssh}, to make sure Plink will try to connect using SSH instead of |
| 125 | Telnet. |
| 126 | |
| 127 | \b Run CVS as follows: |
| 128 | |
| 129 | \c cvs -d :ext:user@hostname:/path/to/repository co module |
| 130 | |
| 131 | \H{plink-wincvs} Using Plink with \i{WinCVS} |
| 132 | |
| 133 | Plink can also be used with WinCVS. Firstly, arrange for Plink to be |
| 134 | able to connect to a remote host without a password. \k{plink-cvs} |
| 135 | has instructions on this. |
| 136 | |
| 137 | In WinCVS, bring up the \e{Preferences} dialogue box from the |
| 138 | \e{Admin} menu, and switch to the \e{Ports} tab. Tick the box there |
| 139 | labelled \e{Check for an alternate rsh name} and in the text entry |
| 140 | field to the right enter the full path to \c{plink.exe}. Select |
| 141 | \e{OK} on the \e{Preferences} dialogue box. |
| 142 | |
| 143 | Next, select \e{Command Line} from the WinCVS \e{Admin} menu, and type |
| 144 | a CVS command as in \k{plink-cvs}, for example: |
| 145 | |
| 146 | \c cvs -d :ext:user@hostname:/path/to/repository co module |
| 147 | |
| 148 | Select the folder you want to check out to with the \e{Change Folder} |
| 149 | button, and click \e{OK} to check out your module. Once you've got |
| 150 | modules checked out, WinCVS will happily invoke plink from the GUI for |
| 151 | CVS operations. |
| 152 | |
| 153 | \H{plink-whatelse} Using Plink with... ? |
| 154 | |