Skip to content

Instantly share code, notes, and snippets.

@ihebski
Created March 19, 2022 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihebski/579e16f70d0ad48684d060aa79c68b66 to your computer and use it in GitHub Desktop.
Save ihebski/579e16f70d0ad48684d060aa79c68b66 to your computer and use it in GitHub Desktop.
auto connect to vpn
#!/usr/bin/expect -f
# Constants
set user ""
set pass ""
set timeout -1
# Options
match_max 100000
log_user 0
# Access to device
spawn sudo openvpn vpn_file.ovpn
expect "*?sername:*"
send -- "$user\r"
expect "*?assword:*"
send -- "$pass\r"
interact
close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment