Forward tcp port on other device to localhost
In this example script ssh port is 2231,
plink forwarding port 3306 to localhost port 3306
@echo off setlocal :: Replace with your actual values set "USER=dev" set "HOST=dev.mangapul.com" set "PASSWORD=V3r1HardP4$$w0Rd" ::set "COMMAND=ls -l" :: Construct the plink command :: plink -ssh %USER%@%HOST% -pw %PASSWORD% %COMMAND% :: -pw password :: -P connect to specified port :: -N don't start a shell/command (SSH-2 only) :: plink -ssh -L 127.0.0.1:3306:dev.mangapul.com:3306 dev@dev.mangapul.com -P 2231 -pw V3r1HardP4$$w0Rd -N plink -ssh -L 127.0.0.1:3306:%HOST%:3306 %USER%@%HOST% -P 2231 -pw %PASSWORD% -N if %ERRORLEVEL% equ 0 ( echo Command executed successfully. ) else ( echo Command execution failed. ) endlocal
No comments :
Post a Comment