2

How do you run a script when a user logs in? I have created a script script.sh and used chmod +x to make it executable where would I place the script to make it startup when a user logs in.

0

1 Answer 1

4

The script ~/.profile is executed at each login, you can put your script here.

But be aware that if you login in two different virtual terminals, the script will be executed twice.

1
  • ~/.profile (which also calls ~/.bashrc) is only executed when logging into a shell (through Terminal or SSH for example). Not when logging into the GUI.
    – mivk
    Oct 18, 2012 at 7:37

You must log in to answer this question.

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