[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 2] Shell Interactive With Zenity Episode 5 -- list

[Level 2] iif in Python