Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-30-2014, 01:39 PM   #1
LQ Newbie
Registered: Mar 2014
Posts: 3

Rep: Reputation: Disabled
Question Run bash script automatically after the root log in

Guys I am new to Linux ... I am using redhat ... I did a script which check if the one logging in is the root or jog but the problem is every time I want the bash script to run I should make right click and open terminal and type sh so if I want the script to run automatic after logging in what steps/commands should I write ???
Old 03-30-2014, 06:23 PM   #2
Senior Member
Registered: Dec 2005
Distribution: Slackware -current, 14.2
Posts: 1,102

Rep: Reputation: 227Reputation: 227Reputation: 227
Put the script in root's .bash_profile ... or .bashrc .

This is the first result of "when is bashrc called" in my search-foo, and it's a nice little explanation of the two, so rather than me reinventing the wheel, give it a read:



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash; automatically run user script after startx has completed porphyry5 Programming 5 03-05-2013 12:55 PM
Run shell script as root automatically elempoimen Linux - Software 8 06-20-2010 01:24 AM
Creating a script that will log into root and enter password and then run commands. tananthulus Linux - Newbie 8 11-02-2009 05:37 PM
Granting root permissions to a bash script than can be run by a user? SirTristan Linux - Newbie 4 06-14-2008 10:29 PM
Getting bash script files to run as root user helptonewbie Programming 5 04-13-2007 09:09 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration