提及Putty大家都不陌生,Putty自带的工具Plink同样强大,本文就简单介绍下几种用法。
Plink使用参数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | Usage: plink [options] [user@]host [command] Options: -V print version information and exit -pgpfp print PGP key fingerprints and exit -v show verbose messages -load sessname Load settings from saved session -ssh -telnet -rlogin -raw -serial force use of a particular protocol -P port connect to specified port -l user connect with specified username -batch disable all interactive prompts The following options only apply to SSH connections: -pw passw login with specified password -D [listen-IP:]listen-port Dynamic SOCKS-based port forwarding -L [listen-IP:]listen-port:host:port Forward local port to remote address -R [listen-IP:]listen-port:host:port Forward remote port to local address -X -x enable / disable X11 forwarding -A -a enable / disable agent forwarding -t -T enable / disable pty allocation -1 -2 force use of particular protocol version -4 -6 force use of IPv4 or IPv6 -C enable compression -i key private key file for authentication -noagent disable use of Pageant -agent enable use of Pageant -m file read remote command(s) from file -s remote command is an SSH subsystem (SSH-2 only) -N don't start a shell/command (SSH-2 only) -nc host:port open tunnel in place of session (SSH-2 only) -sercfg configuration-string (e.g. 19200,8,n,1,X) Specify the serial configuration (serial only) |
1.动态转发端口,可用于代*理上网哦。
1 | plink -N -D 127.0.0.1:7070 root@192.168.1.2 -pw passwd |
2.转发本地端口到远程服务器
1 2 | plink -N -L 127.0.0.1:2222:google.com:80 root@haiyun.me -pw passwd #通过haiyun.me将本地2222端口转发google.com 80端口,浏览器打开127.0.0.1:2222就是谷歌网站 |
3.登录ssh服务器并依次执行文件内的命令。
1 | plink -m cmd.txt root@www.haiyun.me -pw passwd |
4.内网穿透,转发远程服务器端口到本地端口,远程监听指定地址查看:https://www.haiyun.me/archives/1010.html
1 2 | plink -N -R 0.0.0.0:2222:localhost:3389 root@haiyun.me -pw passwd #转发haiyun.me 2222端口到本地3389端口 |