Questions tagged [expect]

79 questions
0
votes
0 answers

I would like to automate the ssh login to an AIX server that hs

I would like to automate the login to an AIX server. I dont have a way to set up ssh keys im on mac so i cant install ssh pass so my only option left would be expect. #!/usr/bin/expect -f set timeout 20 spawn ssh name@host.com expect "*: " send…
0
votes
0 answers

Ansible expect does not pass response to kibana keystore

Ansible expect is not passing ansible variable on first pass. If I make changes and re run the script adding an additional response question then the script seems to work but if I just want to set this up initially first run scenario it doesn't work…
kcomer
  • 21
  • 1
  • 3
0
votes
1 answer

Forwarding access to mysql via ssh tunnel with the help of expect

I have this command that creates a working ssh tunnel for access to MySQL server: ssh -f test@remotehost -L 127.0.0.1:3306:mysqlhost:3306 -N Here, remotehost is accessible only via jump host which I configured with the help of ProxyCommand in…
user541
  • 3
  • 1
0
votes
1 answer

How to use SFTP BatchMode inside EXPECT[Shell Script]

I have set of series SFTP commands which needs to run inside expect. But when i run the below script due to some reasons am not getting any output. Please correct me if am wrong any where inside the script. expect << EOF spawn sftp -oPort=23…
Teja R
  • 3
  • 3
0
votes
0 answers

Expect is prompting password twice while spawn

spawn ssh -q user@xx.xx.xx.xx Password: Password: Expect is expecting null before I sent the password. Debug info expect: does "" (spawn_id exp6) match glob pattern "yes/no"? no "Password: "? no Password: expect: does "Password: " (spawn_id exp6)…
0
votes
1 answer

Ansible expect not passing response

I am trying to use Ansible with the expect module to join a linux server to a active directory with sssd. code from the task: - name: join domain expect: command: /bin/bash -c "/usr/sbin/realm join --user=join-user domain.loc" response: …
SomeGuyOnTheNet
  • 33
  • 1
  • 2
  • 7
0
votes
1 answer

Same script, same OS, same installation, failing

So I'm working with RANCID to monitor some switches and I'm using clogin now to test some modifications. I'm working in two different computers but both of them from the office. Althought they are on different subnets, both can stablish telnet and…
sysfiend
  • 1,327
  • 1
  • 11
  • 24
0
votes
1 answer

Expect Scripting Issue Reading From File

I am trying to change the password for a user on a bunch of linux based routers pulling IPs from a list. The iplist.txt is just a list of ips (one per line). This is the code I am trying to use: #!/usr/bin/expect set timeout 20 #Edit for…
0
votes
1 answer

SSH to ESXi server with Expect immediately closes

I am writing a VM deployment tool that needed to start VMs on an ESXi server. To do this I am using Perl's Expect module to spawn an ssh client to connect to the server and use vim-cmd to manage the VM. When I did this I would see the connection and…
efunneko
  • 245
  • 1
  • 3
  • 11
0
votes
4 answers

How to use expect in Bash script and ssh-copy-id

From a bash script: source ./expect.sh I am including a expect code: #!/bin/bash /usr/bin/expect <
Roger
  • 473
  • 11
  • 22
0
votes
1 answer

catch bash script output from expect, expect hangs

I currently use expect to pass password to rsync to copy files across unix servers test.sh ./expect.sh $password rsync -azvr $username@$host:$file ./$dir expect.sh #!/usr/bin/expect -f …
user12145
  • 1,075
  • 6
  • 26
  • 47
0
votes
0 answers

less doesn't work in LXC container

I'm experiencing some trouble running less and expect inside LXC container (whether using console or SSH) Expect won't work before I won't add an "interact" anywhere in the script, and less doesn't show any output, and exits with status 1…
aqz
  • 1
0
votes
1 answer

Bash Script - Expect does not send password that ends with $!. Also need improvement to report connection timed out

Update: Password issue is fixed and connection timed out message was fixed too. Adding \ before $! worked. Example: *password\$! set passwds { *password\$! @tempP@ss %Test4%} For connection timed out, added the below code after "s password:"…
ajsdg
  • 101
  • 1
  • 1
  • 5
0
votes
1 answer

How to distribute root files with expect?

I've recently learned how great expect is, now that I'm suddenly responsible for managing 150 VMs. I've been using it to distribute config files to remote servers, but there's got to be a better way than what I'm doing. Mainly what I do is things…
dirtside
  • 1,481
  • 4
  • 17
  • 22
0
votes
1 answer

SELinux problems running Expect script from fail2ban

I have an Expect script that works fine if I run it manually, but fails when run as an action from Fail2ban. The error message is as follows: spawn /usr/bin/telnet 192.168.242.1 The system has no more ptys. Ask your system administrator to create…
miken32
  • 930
  • 1
  • 11
  • 32