Self-actively scripting SSH and Telnet sending commands and exiting (both Windows and Linux apply)

Source: Internet
Author: User

need to install putty, the command used is plink: [HTML]View Plaincopy
  1. PuTTY link:command-line Connection Utility
  2. Unidentified build, June 23 2015 11:43:58
  3. Usage:plink [Options] [[Email protected]]host [command]
  4. ("Host" can also be a PuTTY saved session name)
  5. Options:
  6. -V Print version information and exit
  7. -PGPFP print PGP key fingerprints and exit
  8. -V Show verbose messages
  9. -load sessname load settings from saved session
  10. -ssh-telnet-rlogin-raw-serial
  11. Force use of a particular protocol
  12. -p Port Connect to specified port
  13. -l user connect with specified username
  14. -batch Disable all interactive prompts
  15. The following options only apply to SSH connections:
  16. -PW PASSW Login with specified password
  17. -D [Listen-ip:]listen-port
  18. Dynamic socks-based Port forwarding
  19. -L [Listen-ip:]listen-port:host:port
  20. Forward local port to remote address
  21. -R [Listen-ip:]listen-port:host:port
  22. Forward remote port to local address
  23. -x-x enable/disable X11 Forwarding
  24. -a-a enable/disable Agent Forwarding
  25. -T-T enable/disable Pty Allocation
  26. -1-2 Force use of particular protocol version
  27. -4-6 force use of IPv4 or IPV6
  28. -C Enable compression
  29. -I key private key file for authentication
  30. -noagent Disable use of pageant
  31. -agent Enable use of pageant
  32. -m file read remote command (s) from file
  33. -S remote command is a SSH subsystem (SSH-2 only)
  34. -N don ' t start a shell/command (SSH-2 only)
  35. -NC Host:port
  36. Open tunnel in place of the session (SSH-2 only)
  37. -sercfg configuration-string (e.g. 19200,8,n,1,x)
  38. Specify the serial configuration (serial only)

would have been used plink to do tunnel proxy FQ use. Idle to look at the help of boredom, do not see do not know. A look at a frightsuccessfully conquered the once not realized function, special to record
Useful Scenario 1:The product is sent to the user later found a bug. But the installation of the location can only be remote, and the number is very large, this time need to upgrade the product how to do, it is not possible to SSH, or page configuration bar, then their own initiative SSH send command to send the use, a script loop ssh. wget firmware and upgrade one go. The company has met before .
Useful Scenario 2:now there are 1000 boards shipped to be labeled, and the MAC address was not recorded for some reason. This time how to do, it is not possible to go to the landing copy and paste. Save it to the printer, a script print out, it's so wayward
SSH login execute ls command : echo y| plink-ssh [email protected]-PW password ls
SSH Login Run command.txt command in turn: echo y| plink-ssh [email protected]-PW password-m command.txt
telnet Login to execute ifconfig and exit: ? Echo ' ifconfig; exit '| plink-telnet 192.168.1.1  Besides, there 's-ssh-telnet-rlogin-raw-serial.

based on these core commands, you can enjoy the
Learning

Test found SSH passed up to 1024 characters

Self-actively scripting SSH and Telnet sending commands and exiting (both Windows and Linux apply)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.