简体   繁体   中英

how to run script after user login but not for root

i want to run a script for all user and new user after the login but not for root . I add my script on /etc/profile.d but unfortunathely. the script is executed for all users logged in but also for root and i dont want that .

Do you have an idea how i can do that ?

You could check the EUID in the script:

if [ ${EUID} -eq 0 ] ; then
    echo "Not running this script since you are root"
    exit 1
fi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM