2
votes
1answer
86 views

SSH Command behaves differently in Expect Script

I'm using this command on Server1 ~# ssh root@Server2 /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys to append the contents of Server2's id_rsa.pub to the authorized_keys of Server1. It ...
2
votes
1answer
63 views

Problem on running Script on host after connecting

I am new to linux scripting. Please help. I searched on below a lot but was not able to find appropriate answer : I am trying to make a script which I will later schedule as cronjob, so that it keeps ...
1
vote
2answers
4k views

Bash script calls expect script with master SSH connection

I'm trying to write a bash script that calls an expect script to establish a master SSH connection to be used for the remaining SSH commands in the bash script. ~/.ssh/config: ControlMaster auto ...
1
vote
2answers
509 views

PHP exec expect script with SCP then SSH

I have a PHP page which runs the following expect script to upload a file to another server on my network: #!/usr/bin/expect -f set password [lindex $argv 0] spawn /usr/bin/scp /home/Dave/bin/test ...
0
votes
3answers
739 views

Script to login to ssh twice

I need to login through ssh twice with a script and can't get it to work. This is what I have in my script file: #!/usr/bin/expect set login "user" set addr "address1" set addr2 "address2" set pw ...
2
votes
2answers
866 views

How to automate connecting to multiple network devices, running a command and saving the output to a file?

I have to run a command on around 1000 network devices and save the output to a file. In a file I have a list of all the network device names that have to be connected to using SSH. I then have to run ...
0
votes
1answer
364 views

Counting files on a remote server with ssh and an expect script

Below is my script to take count for files which are present in remote server. But it is not working. Please help me. #!/usr/bin/expect spawn ssh sduser@172.0.0.2 expect "123" send "123" interact ...
1
vote
2answers
4k 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 ...
5
votes
3answers
22k views

Shell Script for logging into a ssh server

I tried writing a shell script which can do automatic login into a ssh server using password which is mentioned in the script. I have written the following code: set timeout 30 /usr/bin/ssh -p 8484 ...
3
votes
4answers
1k views

passing passwords to a script

I want to scp a file to a remote host, and from there, run a command on the file, and exit the remote session. If I write a usual script, call scp and then ssh, I am prompted to enter two passwords. ...
2
votes
3answers
2k views

Pass the background flag (&) through expect and ssh

My command line/bash fu is extremely weak, but I'm trying to hone my abilities. Hopefully someone can help. I wrote a super simple expect script so that I can SSH in to a headless box we're using at ...