I have found many explanations of how to schedule a task to run on system start (which I am already doing by means of an entry starting with @reboot in /etc/crontab) or on login for a particular user (this thread seems to cover all the bases). However, I would like to create a task to run when an AD domain user logs in to a Ubuntu client PC. As a workaround, I would settle for a task which would run at login for any/every user on the Ubuntu PC (it would simply fail for local users).
Asked
Active
Viewed 610 times
1 Answers
0
I got this to work by creating a shell script in the directory /etc/profile.d containing:
if [[ " $(groups) " =~ ' domain users@my.domain.name ' ]]; then
# Whatever you want to do for all group members goes here.
fi
The script runs automatically on login as long as the file extension is .sh. To prevent problems with output to a non-existent terminal, I append >/dev/null to the commands in the body of the if statement.
R B
- 368