Basic Client Use

To get started, just run (or double-click) putty.exe. The PuTTY Configuration dialog shown in Figure 18-1 will appear:

For a quick start, locate the box labeled “Host Name (or IP address),” enter the hostname of your remote server machine, and click the Open button. A terminal window then appears and prompts you for your login name and password. Assuming

PuTTY Configuration dialog

Figure 18-1. PuTTY Configuration dialog

there’s nothing unusual about your SSH server, you’re done: PuTTY establishes a secure login session with the server.

Tip

PuTTY supports not only SSH, but also insecure protocols like Telnet and Rlogin. Make sure your connections are using the SSH protocol by selecting SSH on the initial PuTTY Configuration dialog. SSH is the default protocol for the other programs in the suite, such as Plink, PSFTP, and PSCP.

18.2.1 Plink, a Console Client

PuTTY comes with a second SSH terminal client, Plink, which is reminiscent of the ssh client of OpenSSH and Tectia. For a quick start, open a command window and type:

    C:> plink [email protected]

This command connects you via SSH to server.example.com, logging in as remote user smith.

Plink is most appropriate for noninteractive use: for example, setting up tunnels for port forwarding, or running inside batch jobs. It can also handle interactive logins, but PuTTY is a better choice, particularly for screen-based programs like text editors. The Windows command line is not a particularly good terminal emulator.

The plink client has many command-line options, similar to those of ssh. Run plink by itself to see a list of valid options, as shown in Table 18-1.

Table 18-1. plink command-line options

Option

Meaning

1

Use SSH-1 protocol.

2

Use SSH-2 protocol.

C

Use compression for the SSH connection. [7.4.14]

-i keyname

Use the private key keyname.

-l username

Specify the remote username (if omitted, it defaults to your local username).

-load session

Load settings from a saved session.

-m filename

Read remote commands from the file filename.

-pw P

Use password P.

-P port

Use TCP port port to connect to the remote SSH server.

-s

Use an SSH subsystem. [5.8]

-t

Allocate a pseudo-terminal (pty).

-T

Do not allocate a pseudo-terminal. (pty).

-v

Print verbose diagnostics.

V

Display the program version.

18.2.2 Running Remote Commands

Instead of an interactive terminal session, PuTTY and Plink can run a single command of your choice, then exit immediately. It’s simplest with Plink: just append the remote command to the Plink command line. For example, to run the ls (list files) command on a remote Linux machine running an SSH server, type:

    C:> plink [email protected] ls

With PuTTY, visit the PuTTY Configuration dialog and look under Connection/SSH. Fill in the blank labeled “Remote command,” then connect. The command will run and PuTTY will terminate afterward.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.42.164