Shell script password input | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Shell script password input

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-13-2013
tomies tomies is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 14 February 2013, 5:39 AM EST
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Shell script password input

hy,

I wrote a simple shell script to monitor (with Nagios) a SNX VPN function. Here the Code snippet:


Code:
testing=`ssh user@IP-address 'ls /etc/sysconfig/network-scripts/ifcfg-eth0'`

#echo $testing


if [ $testing = "/etc/sysconfig/network-scripts/ifcfg-eth0" > /dev/null 2>%1 ]; then
        echo "VPN is working"
        exit 0

else    snx -s server -u user
        exit 0
fi

As you could see if the VPN connection is establised I got a simple output text in Nagios. But when the VPN connection isnīt up and running I want to establise a connection with the command "snx -s server -u user".
Than I have to put in a Password manually


Code:
Check Point's Linux SNX
build 800007075
Please enter your password:

And there I run into problems. How could I automate such a login within the script? Any Ideas?


regards
Tommy
Sponsored Links
    #2  
Old 02-13-2013
zazzybob's Avatar
zazzybob zazzybob is offline Forum Advisor  
Registered Geek
 
Join Date: Dec 2003
Last Activity: 13 May 2013, 9:02 AM EDT
Location: Melbourne, Australia
Posts: 2,185
Thanks: 3
Thanked 24 Times in 23 Posts
You could do this with Expect (Expect - Expect - Home Page).
The Following User Says Thank You to zazzybob For This Useful Post:
tomies (02-13-2013)
Sponsored Links
    #3  
Old 02-13-2013
tomies tomies is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 14 February 2013, 5:39 AM EST
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
Thanks that works perfect for me...

regards tommy
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to input encrpyted password into htdigest (Apache) xxxx Shell Programming and Scripting 0 01-25-2012 02:42 AM
password file as std input to script mpheine Shell Programming and Scripting 2 09-01-2011 05:45 PM
Input in shell script urug3170 Shell Programming and Scripting 2 06-18-2010 12:13 PM
how to change root password using shell script with standard password kurva Shell Programming and Scripting 2 02-25-2009 02:35 AM
Input to shell script castlerock Shell Programming and Scripting 3 04-03-2006 06:26 AM



All times are GMT -4. The time now is 09:28 PM.