Skip to content

Instantly share code, notes, and snippets.

@greut
Created February 20, 2020 11:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save greut/d5b1d72be9b3193372c7e223f639dae8 to your computer and use it in GitHub Desktop.
Save greut/d5b1d72be9b3193372c7e223f639dae8 to your computer and use it in GitHub Desktop.
connecting to HE-Arc vpn
#!/bin/bash
USERNAME=yoan.blanc
PASSWORD="..."
GID=100
DIRS="ORG"
PID=openconnect.pid
echo "Welcome to HE-ARC"
echo ""
echo "$PASSWORD" | sudo openconnect vpnclust1.he-arc.ch -u $USERNAME \
-b --pid-file $PID --passwd-on-stdin
for dir in $DIRS; do
echo sudo mount -t cifs "//intra.he-arc.ch/${dir}" "intranet/${dir}" \
-o "username=${USERNAME},password=${PASSWORD},uid=${UID},gid=${GID}"
echo "Mounted intranet/${dir}"
done
cleanup () {
for dir in $DIRS; do
echo sudo umount "intranet/${dir}"
done
sudo kill `cat ${PID}`
echo "Bye bye!"
exit 0
}
echo ""
echo press "Ctrl-C" to close
trap cleanup SIGINT
# main loop
while true; do read x; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment