02-17-2012
I'm not even questioning how to send the password, log in, etc... My question is about error handling with expect. The other parts of the script are already working.
I'm interested in expects ability to see a prompt and send certain text back as a response, and when a prompt is received that is different than what is expected how to handle that.
Quote:
Originally Posted by
Corona688
If you used sftp with keys, you wouldn't need to install or use a third-party brute-forcing utility to forcefeed plaintext passwords into ssh in an insecure manner for you. "interactive password authentication" means "password typed by a human being in realtime authentication" and nothing else will do. It's so difficult for a reason -- ssh is designed to prevent it, because it's almost impossible to keep unencoded passwords secure, and because allowing them would be just the avenue hackers need to bruteforce your own system or use your system as a platform to bruteforce others.
Google 'passwordless ssh' to find the proper way to do this with keys, there's hundreds of tutorials all over the internet.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Guys,
I'm testing a simple script that connects to a server, does a few checks and sends the results to a file.
code:
#!/bin/ksh
expect <<-EOF | sed 's/^M//' >> file
spawn ssh user@server
expect "password:" { send "password \n" }
expect "$"
send "df -k /dev/md/dsk/d10 |... (4 Replies)
Discussion started by: tony3101
4 Replies
2. Shell Programming and Scripting
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies
3. Shell Programming and Scripting
Hi everybody,
We are trying to connect to a server and to a router using an .expect script that automatically authenticate the username and password needed. The error is that we cannot connect to the server using ssh AND we cannot connect to the router using either telnet or go commands from the... (1 Reply)
Discussion started by: omoyne
1 Replies
4. Shell Programming and Scripting
Hi,
I am trying to write a script to cleanup files in a log directory ..
cd log
find Datk** -mtime +7 -exec rm -f {} \; 2> /dev/null
Have used the above to clean up files in log directory more then 7 days older.
The file can be something like ( auto-generate by some processes and... (2 Replies)
Discussion started by: nss280
2 Replies
5. Shell Programming and Scripting
Hi All,
I have a doubt whether expect module in perl will work in SQL prompt or its applicable only for shell prompt ?
Thanks,
Arun V (2 Replies)
Discussion started by: arun_maffy
2 Replies
6. Shell Programming and Scripting
Hi,
I need your guys help again. I run a script which check for some process status in a loop. when i check the process some of the process could throw an error, how can i check that inside my script.
Thanks,
RR (3 Replies)
Discussion started by: rrb2009
3 Replies
7. Shell Programming and Scripting
Hi all,
I have some sections of a script that I am trying to add error handling to. Basically if it returns any error, just continue. This is for a deployment script that i am writing to assist in the deployment of scripts out to other systems.
At the top of my KSH script i added this... (5 Replies)
Discussion started by: nitrobass24
5 Replies
8. Shell Programming and Scripting
Hi,
in my bash script I start 3rd party app that runs quickly normally and returns some data that I use later for processing. However if there are problems the app doesn't return anything and just hangs... then my script also hangs of course, awaiting for the app to comeback. Was wondering how to... (3 Replies)
Discussion started by: TomSu
3 Replies
9. Shell Programming and Scripting
Hi,
I have ftp script like below
How to insert an error handling, If the transfer failed then send mail to me.
Actually, I just need the script to send an email if the FTP failed. How to put the email script within FTP script?
Thank You
Edy (5 Replies)
Discussion started by: edydsuranta
5 Replies
10. Shell Programming and Scripting
Hello Geeks once more,
Thanks for all the help you have been rendering..
I have a script that depends on the output of an expect statement but sometimes the main script misbehaves which I believe is a result of SSH communication error, how can I apply an error control to know whether the... (2 Replies)
Discussion started by: infinitydon
2 Replies