Another small trick, using the expect scripting language to implement SSH automatic connection to the server, you can automatically enter the password. Because every time using SSH root@xx.xx.xx.xx connection server, you have to manually enter the
I've learned some shells before, but not very deep, and the time to write code is not much. Shortly before the shell was more thin, leader assigned a task to write a script with the shell to upload the Redis source tarball from one server to another
expect is a program that allows you to "session" with an interactive program in a way that is set in the script content. Depending on the content of the script, expect can tell what content the program prompts or feeds and what is the correct answer.
Shell script implementation SSH Automatic login remote Server example:#!/usr/bin/expectspawn ssh [email protected]expect "*password:"send "123\r"expect "*#"interact Original link: http://www.xuanhao360.com/linux-expects/Expect is a command to handle
background: In the remote file download, you need to enter the other party's server password, the shell does not support interactive input content, can be implemented in the following two ways I. Embedding expect in shell scripts for password
For Linux OPS workers, using SSH remote remote server is no longer familiar! Some of the strict settings for SSH also related to server security maintenance, today, I work in the use of SSH experience, do some summary records to the next. (1) After
Because of the client side of the fast 30 projects in a special sequence of restart, so have to find a way to write a script, online read a lot of jokes. It's a broken can. No one can work properly. I'll record it in order.The script itselfUse
Recent project requirements, need to write some shell script interaction, the pipeline is not enough time, expect can be very good to implement the interaction between the script, search for information, found that many articles on the Web are
Expect everywhere.
The first time I saw expect this command was the first time I was in full volume that's one of the company's cows. A set of automatic deployment, MD5, release of the full online tool written by the shell script, when it's okay,
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.