run_as_user

This commit is contained in:
simono41 2018-02-02 13:30:19 +01:00
parent 57e7622081
commit fc506c1dd3
4 changed files with 8 additions and 4 deletions

View file

@ -4,7 +4,8 @@ set -ex
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2 echo "This script must be run as root" 1>&2
exit 1 sudo $0
exit 0
fi fi
echo 1 > /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_forward

View file

@ -7,7 +7,8 @@ set -ex
if [[ "$EUID" -ne 0 ]]; then if [[ "$EUID" -ne 0 ]]; then
echo "Sorry, you need to run this as root" echo "Sorry, you need to run this as root"
exit 1 sudo $0
exit 0
fi fi
if [[ ! -e /dev/net/tun ]]; then if [[ ! -e /dev/net/tun ]]; then

View file

@ -4,7 +4,8 @@ set -xe
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2 echo "This script must be run as root" 1>&2
exit 1 sudo $0
exit 0
fi fi
apt update apt update

View file

@ -5,7 +5,8 @@ set -ex
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2 echo "This script must be run as root" 1>&2
exit 1 sudo $0
exit 0
fi fi
if [ "change" == "$1" ]; then if [ "change" == "$1" ]; then