Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
~/.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 '12 at 7:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.