From d1e2f8a3e5e64448a5fad5e408ba0df3b2391415 Mon Sep 17 00:00:00 2001 From: Lucas Vivo Date: Fri, 16 Oct 2026 17:42:58 +0200 Subject: [PATCH] assign raw socket access to etherwake --- network/wol.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/network/wol.sh b/network/wol.sh index d60ac0b..9d7e13c 100755 --- a/network/wol.sh +++ b/network/wol.sh @@ -12,6 +12,11 @@ else printf "Nonsense Input, hostname needed\n" exit 0 fi + +if [[ "$(getcap /usr/sbin/etherwake)" != "/usr/sbin/etherwake cap_net_raw=ep" ]]; then + echo "Assign raw socket access to etherwake" + sudo setcap cap_net_raw+ep /usr/sbin/etherwake +fi mapfile -t ifx < <( ip -o link show | awk -F': ' '{print $2}' | @@ -19,7 +24,7 @@ grep -E '^(eth[0-9]+|en[a-z0-9]+|wlan[0-9]+|wl[a-z0-9]+)$' ) echo ${ifx[@]} for i in ${!ifx[@]}; do - sudo /usr/sbin/etherwake -b -i ${ifx[$i]} $mac + /usr/sbin/etherwake -b -i ${ifx[$i]} $mac printf "%shost succsefully woken via ${ifx[$i]}: ${mac}\n" "$device" done if [ "$(echo $SSH_CONNECTION | cut -f1 -d' ')" == "10.0.0.26" ]; then