[Level 2] Use expect to run openvpn.

#!/usr/bin/expect
set password [lindex $argv 0]
spawn sudo openvpn --script-security 2 --config /home/stanley/VPN/MyVPN_config/MyVPN.ovpn
expect Enter\ Private\ Key\ Password:
sleep 1
send $password
sleep 1
interact
Test run:
# ./openvpn.expect mypassword
Wish this helps.
 regards,
Stanley Huang

Comments

Popular posts from this blog

[Level 1] Rar tool for Solaris.

[Level 2] iif in Python