I want to program a script that is launched whenever a specific user, let's call it user log in.

For example, when you log on to the computer with that user or using the su command on a terminal.

I can use any software such as crontab, anacron or at; or any other similar software.

preferably crontab, if you could:

? ? ? ? ? user /path/script.sh
  • 2
    this you want is a job of .bash_profile or .bashrc` files in the home directory of the user Mar 12, 2020 at 12:19
  • Please see man pam_access to have better control of login process. You could run scripts, send an email when someone logs in and so on. Mar 12, 2020 at 12:37

1 Answer 1


finally, as @Romeo Ninov mentioned in a comment, I added the script to .bashrc from user so that it is executed each time it is logged in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .