how to check SUDO permission $EUID = 0

#!/usr/bin/env bash
if [[ $EUID = 0 && "$(ps -o comm= | sed -n '1p')" = "su" ]]; then
    echo "sudo!"
else
    echo "not sudo!"
fi

Comments

Popular posts from this blog

HAproxy logging

teamcity Automatic Agent Start under Linux

15 managing disk - understanding /etc/fstab xfs_admin mount -o rw,remount /