Saturday, July 7, 2012

How to run batch commands using Plink program

How to run batch commands using Plink program in windows enviroment

for /f %i in (devices.txt) do c:\putty\plink.exe cisco@%i -pw
P@55W0rD! -m command.txt >> device_utilization.txt
(if you put this in a batch file, be sure to use "%%i" and not the
"%i" as the batch will strip the single percents)

Reference: Automate Cisco ssh connections with plink in Windows


Very useful Plink tips 

Host wants to forward traffic from local port 1234 to 80.101.152.38:443 via a SSH server 

@echo off
plink.exe -v -x -a -T -C -noagent -ssh -L 127.0.0.1:1234:80.101.152.38:443 <username>@<IP SSH server>

from: Tunneling sessions via Plink

Linux syntax:

Host wants to tunnel from local port 53 to destination port 5900 via a SSH server

ssh -L 53:[destination IP]:5900 [SSH server IP]

SSH Tunneling

No comments:

Post a Comment