psftp> get myfile.dat
using the Windows ren command to rename files on your local PC.
6.3 Using public key authentication with PSFTP
Like PuTTY, PSFTP can authenticate using a public key instead of a password. There are three ways you can do this.
Firstly, PSFTP can use PuTTY saved sessions in place of hostnames. So you might do this:
•Run PuTTY, and create a PuTTY saved session (see
section 4.1.2
) which specifies your private key file (see
section 4.21.8
).
You will probably also want to specify a username to log in as (see
section 4.14.1
).
•In PSFTP, you can now use the name of the session instead of a hostname: type psftp sessionname, where sessionname is replaced by the name of your saved session.
Secondly, you can supply the name of a private key file on the command line, with the -i option. See
section 3.8.3.18
for more
information.
Thirdly, PSFTP will attempt to authenticate using Pageant if Pageant is running (see
chapter 9
). So you would do this:
•Ensure Pageant is running, and has your private key stored in it.
•Specify a user and host name to PSFTP as normal. PSFTP will automatically detect Pageant and try to use the keys within it.
For more general information on public-key authentication, see
chapter 8
.
Chapter 7: Using the command-line connection tool Plink
Plink is a command-line connection tool similar to UNIX ssh. It is mostly used for automated operations, such as making CVS access a repository on a remote server.
Plink is probably not what you want if you want to run an interactive session in a console window.
•
7.1 Starting Plink
•
7.2 Using Plink
o
7.2.1 Using Plink for interactive logins
o
7.2.2 Using Plink for automated connections
o
7.2.3 Plink command line options
•
7.3 Using Plink in batch files and scripts
•
7.4 Using Plink with CVS
•
7.5 Using Plink with WinCVS
7.1 Starting Plink
Plink is a command line application. This means that you cannot just double-click on its icon to run it and instead you have to bring up a console window. In Windows 95, 98, and ME, this is called an ‘MS-DOS Prompt’, and in Windows NT, 2000, and XP, it is called a ‘Command Prompt’. It should be available from the Programs section of your Start Menu.
In order to use Plink, the file plink.exe will need either to be on your PATH or in your current directory. To add the directory containing Plink to your PATH environment variable, type into the console window:
set PATH=C:\path\to\putty\directory;%PATH%
This will only work for the lifetime of that particular console window. To set your PATH more permanently on Windows NT, 2000, and XP, use the Environment tab of the System Control Panel. On Windows 95, 98, and ME, you will need to edit your AUTOEXEC.BAT to include a set command like the one above.
7.2 Using Plink
This section describes the basics of how to use Plink for interactive logins and for automated processes.