Skip to main content

Questions tagged [expect]

Expect is a utility based on TCL. It's primary use is for building automation into interactive environments such as telnet or ssh based terminal environments. It provides the ability to enter commands on a command line and interpret the output.

2 votes
2 answers
12k views

couldn't execute "mysql": no such file or directory, using autoexpect

I have the following file: exp.exp #!/usr/bin/expect db_host='localhost' db_name='webui_dev' db_user='root' db_pass='rootpass' new_db_name='db_2011' expect <<EOF log_user 0 spawn mysql -h ...
Andrey Yasinishyn's user avatar
0 votes
1 answer
996 views

Expect not working using -c arguments

So I have an expect script like this that works: #!/usr/bin/expect spawn scp [email protected]:* . expect { password: {send "mypassword"; exp_continue} } Based on the man page for expect, I think I ...
Gordon Seidoh Worley's user avatar
1 vote
1 answer
2k views

Expect and sudo timeout

I have a main shell script that prompts the user for his password. I then would like to call an expect script while passing the password to it. This expect script will run 3 sudo commands. I know the ...
Codrguy's user avatar
  • 325
2 votes
2 answers
2k views

Bash/expect script to log in via ssh and port knocking. SSH Keys not possible

My login server is behind a firewall that uses port knocking to allow entry. The login-flow is Enter in port knocking command. This requires my external IP to be entered. When prompted, enter in my ...
Zach Melnick's user avatar
0 votes
3 answers
16k views

how to run a local script in remote server using expect and bash script

I want to make a script that will connect to a server and do some CRUD operation on the server and again return to local. I do not want to upload the script to server.. I have made a script that ...
user1760929's user avatar
14 votes
1 answer
121k views

What is the meaning of the "spawn" command in Linux (Centos6)

I need to know how to set up a cron job that automatically connects to a remote server, then changes to a directory and downloads all the files in that directory to local. I think I have to use SFTP ...
user1179459's user avatar
0 votes
1 answer
6k views

Auto log in SSH using expect

I wrote a script to auto login into a remote server. The login data is stored in a database. /usr/bin/expect <<EOD spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no $SSHUser@$SSHHost ...
Jelle De Loecker's user avatar
2 votes
2 answers
9k views

Installation of Expect on Windows 7 64-bit fails with "not found in the archives"

Downloaded ActiveTcl from http://www.activestate.com/activetcl/downloads/ Installed ActiveTcl at c:/Tcl/ Go to Bin directory in command prompt (Start > Run > cmd > cd c:\Tcl\bin) To install Expect, I ...
user avatar
0 votes
1 answer
3k views

SSH + Sudo + Expect in Bash script: Run command with sudo in remote machine

I am trying to automate the deploy of some .deb packages with an script. I want to execute sudo dpkg -i $myDeb.deb in a list of remote machines I can access with ssh. I've tried to automate the ...
Savir's user avatar
  • 117
1 vote
1 answer
2k views

Why doesn't redirect work for scp password input?

I want to copy from remote box with scp, while the fact that each time I have to re-enter password is annoying. So I store my password in plain text and expect the following code should work scp -...
Summer_More_More_Tea's user avatar
0 votes
1 answer
5k views

Expect script inside bash script optional statement

Using: CentOS 6.2 BASH shell My script is something along the lines of #!/bin/bash INSTALL_PATH="Enter install path" CR="\n" /bin/su root -c "/usr/bin/expect << EOF spawn name.run expect $...
Jason R. Mick's user avatar
0 votes
3 answers
4k views

Linux spawn, expect, send

The following code isn't working, but what I want to do is answer "n" whenever YUM asks whether I want to install the software or not. Thanks #!/usr/bin/expect -f spawn yum install emacs expect "Is ...
Chun Tat David Chu's user avatar
1 vote
1 answer
2k views

Problems automating sftp with expect

I'm trying to automate data transfer using sftp. I have a hacky expect script that grabs the data file. Unfortunately, partway through transfer the file is unexpectedly truncated. When I tried ...
Dan S's user avatar
  • 113
5 votes
3 answers
11k views

How to by-pass user interactions in a script?

I am trying to automate the installation of a program through a shell script. There are a few steps which require user interaction from the command line (confirmation, yes/no, etc.). What is the best ...
Vignesh's user avatar
  • 53
1 vote
1 answer
566 views

Can the expect utility handle a case where the process it spawns also spawns a sub process?

I'm trying to use expect to handle rsync over an ssh shell, but it gets stuck. If I run my rsync command it works (simplified here): It prompts me for my password and copies files to the server: ...
davidparks21's user avatar
  • 1,612

15 30 50 per page