A script that requires root privileges needs to be executed when a non-root privileged user signs in/out. How do I handle this?
Asked
Active
Viewed 1,452 times
2 Answers
1
lightdm, the display manager in Ubuntu allows running session setup scripts as root if you add appropriate entry to /etc/lightdm/lightdm.conf file (Note, that this file doesn't exist as of 14.04, you have to manually create it).
Example of how it might look like
[SeatDefaults]
# session-setup-script = Script to run when starting a user session (runs as root)
session-setup-script=/opt/myscripts/print_hello.sh
# session-cleanup-script = Script to run when quitting a user session (runs as root)
session-cleanup-script=/opt/myscripts/print_hello.sh
Sergiy Kolodyazhnyy
- 107,582