I would like to connect my VPN after wake-up.
1) I have created a script in my home (wakeup.sh)
#! /bin/bash
(echo "Sortie de veille: lancement de wakeup le $(date '+%d/%m/%Y a %H:%M')"
sleep 30
nmcli con up id "My_id_xxxxxx"
echo "-------------------END LOG-------------------") 2>&1 | tee -a /home/guillaume/sortie_veille_auto.log
2) I have created a service in /etc/systemd/system/ named wakeup.service:
[Unit]
Description=Run user script after suspend
After=basic.target
After=suspend.target
After=hibernate.target
[Service]
User=guillaume
Environment=DISPLAY=:0
ExecStart=/home/guillaume/wakeup
[Install]
WantedBy=basic.target
WantedBy=suspend.target
WantedBy=hibernate.target
3) Then, I have activated it with
systemctl enable wakeup.service
and
systemctl status wakeup.service
to verify.
4) After a try, the script is launched, but I have this error in the log:
Erreur : l'activation de la connexion a échoué : Not authorized to control networking.
What's wrong ? nmcli can work with a normal user.