Using PuTTY for Serial PuTTY can replace HyperTerminal for serial communications. It provides logging, a large scroll back buffer, and many other features. You are probably already using PuTTY for SSH and Telnet, but you can also use it for Serial TTY console connections. I want to run cmds.txt cmd in ssh port connectivity. How to run txt file with putty. How to automate putty commands when connection is through ssh? closed Ask Question Asked 3 years. Browse other questions tagged shell-script ssh putty or ask your own question.
![]()
Previous | Contents | Index | Next
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
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:
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.
Once you've got a console window to type into, you can just type
plink on its own to bring up a usage message. This tells you the version of Plink you're using, and gives you a brief summary of how to use Plink:
Once this works, you are ready to use Plink.
7.2.1 Using Plink for interactive logins
To make a simple interactive connection to a remote server, just type
plink and then the host name:
You should then be able to log in as normal and run a session. The output sent by the server will be written straight to your command prompt window, which will most likely not interpret terminal control codes in the way the server expects it to. So if you run any full-screen applications, for example, you can expect to see strange characters appearing in your window. Interactive connections like this are not the main point of Plink.
In order to connect with a different protocol, you can give the command line options
-ssh , -telnet , -rlogin or -raw . To make an SSH connection, for example:
If you have already set up a PuTTY saved session, then instead of supplying a host name, you can give the saved session name. This allows you to use public-key authentication, specify a user name, and use most of the other features of PuTTY:
(You can also use the
-load command-line option to load a saved session; see section 3.8.3.1. If you use -load , the saved session exists, and it specifies a hostname, you cannot also specify a host or user@host argument - it will be treated as part of the remote command.)
7.2.2 Using Plink for automated connections
More typically Plink is used with the SSH protocol, to enable you to talk directly to a program running on the server. To do this you have to ensure Plink is using the SSH protocol. You can do this in several ways:
Usually Plink is not invoked directly by a user, but run automatically by another process. Therefore you typically do not want Plink to prompt you for a user name or a password.
Next, you are likely to need to avoid the various interactive prompts Plink can produce. You might be prompted to verify the host key of the server you're connecting to, to enter a user name, or to enter a password.
To avoid being prompted for the server host key when using Plink for an automated connection, you should first make a manual connection (using either of PuTTY or Plink) to the same server, verify the host key (see section 2.2 for more information), and select Yes to add the host key to the Registry. After that, Plink commands connecting to that server should not give a host key prompt unless the host key changes.
To avoid being prompted for a user name, you can:
To avoid being prompted for a password, you should almost certainly set up public-key authentication. (See chapter 8 for a general introduction to public-key authentication.) Again, you can do this in two ways:
Once you have done all this, you should be able to run a remote command on the SSH server machine and have it execute automatically with no prompting:
Or, if you have set up a saved session with all the connection details:
Then you can set up other programs to run this Plink command and talk to it as if it were a process on the server machine.
7.2.3 Plink command line options
Plink accepts all the general command line options supported by the PuTTY tools. See section 3.8.3 for a description of these options.
Plink also supports some of its own options. The following sections describe Plink's specific command-line options.
![]() 7.2.3.1
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |