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

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all