From fc506c1dd3a2f8b6cef100250c23dc0acb548227 Mon Sep 17 00:00:00 2001 From: simono41 Date: Fri, 2 Feb 2018 13:30:19 +0100 Subject: [PATCH] run_as_user --- arpspoof.sh | 3 ++- openvpn-install.sh | 3 ++- shellscripte.sh | 3 ++- uefi-boot.sh | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arpspoof.sh b/arpspoof.sh index f6d26bf..ea0f26e 100755 --- a/arpspoof.sh +++ b/arpspoof.sh @@ -4,7 +4,8 @@ set -ex if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 - exit 1 + sudo $0 + exit 0 fi echo 1 > /proc/sys/net/ipv4/ip_forward diff --git a/openvpn-install.sh b/openvpn-install.sh index d10fd92..3f06b67 100755 --- a/openvpn-install.sh +++ b/openvpn-install.sh @@ -7,7 +7,8 @@ set -ex if [[ "$EUID" -ne 0 ]]; then echo "Sorry, you need to run this as root" - exit 1 + sudo $0 + exit 0 fi if [[ ! -e /dev/net/tun ]]; then diff --git a/shellscripte.sh b/shellscripte.sh index fcb81a0..3029a9a 100755 --- a/shellscripte.sh +++ b/shellscripte.sh @@ -4,7 +4,8 @@ set -xe if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 - exit 1 + sudo $0 + exit 0 fi apt update diff --git a/uefi-boot.sh b/uefi-boot.sh index b4f918a..ac78305 100755 --- a/uefi-boot.sh +++ b/uefi-boot.sh @@ -5,7 +5,8 @@ set -ex if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 - exit 1 + sudo $0 + exit 0 fi if [ "change" == "$1" ]; then