Wilbert Santos
Wilbert Santos

Reputation: 11

How to Connect to a Router Using Putty

I am trying to connect to a router directly using Putty. Using the following commands I can connect to terminal servers:

putty.exe -ssh <IP> p 22 -l <user> -pw <mypassword>

output TS#

using that command, Putty will open directly to TS#, then I input the router name in Putty to go to the router.

output: routername#

My question is: how can I connect to the router directly using SSH, using this command:

putty.exe -ssh <IP> p 22 -l <user> -pw <mypassword>

What command should I add to so that I am connected directly to router after connecting in terminal servers?

Upvotes: 0

Views: 15655

Answers (1)

Conner
Conner

Reputation: 31040

You can use the -m flag to execute a script on login.

3.8.3.6 -m: read a remote command or script from a file

The -m option performs a similar function to the ‘Remote command’ box in the SSH panel of the PuTTY configuration box (see section 4.18.1). However, the -m option expects to be given a local file name, and it will read a command from that file.

With some servers (particularly Unix systems), you can even put multiple lines in this file and execute more than one command in sequence, or a whole shell script; but this is arguably an abuse, and cannot be expected to work on all servers. In particular, it is known not to work with certain ‘embedded’ servers, such as Cisco routers.

This option is not available in the file transfer tools PSCP and PSFTP.

via http://the.earth.li/~sgtatham/putty/0.62/htmldoc/Chapter3.html#using-cmdline

Upvotes: 0

Related Questions