I have a script which I want to run just after user log-in authentication. To accomplish this, I added the script name in /etc/rc5.d/S##rc.local
file. But later i got to know that, anything that is added in rc.local file gets executed in boot time of the system not after the login authentication. Can anyone tell me how to run the script after user login authentication?
Try adding this to your /etc/pam.d/login
:
session optional pam_exec.so /bin/bash /path/to/your/script.sh
You will need to check in your script if the current user is actually an administrator (according to whatever your criteria for being administrator are).
For Linux Mint and Ubuntu with Desktop environment there is a option in main menu called "Startup Applications", just go there and add the path to the script file. This script will run after login in window manager.
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.