Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 10-30-2003, 05:57 AM   #1
LQ Newbie
Registered: Oct 2003
Posts: 2

Rep: Reputation: 0
Trying to execute bash script upon login??

Hi Everyone,

I am using Redhat 9 and am somewhat of a newbie. I have a bash menu script i am trying to execute for some users. I have given the script the correct permissions and ownership, and set the shell to /bin/scriptname in the passwd file, but when i log on as one of these users i just get:

/bin/scriptname: Permission Denied

I can't figure out what i have missed. Any help would be appreciated.

Old 10-30-2003, 07:29 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
it's probably still not exectuable.... chmod +x scriptname also make sure it has a valid interpreter listed at the top.

/bin isn't a good place to put a file you created yourself though... /usr/local/bin would be more normal.
Old 10-30-2003, 09:56 AM   #3
LQ Newbie
Registered: Oct 2003
Posts: 2

Original Poster
Rep: Reputation: 0
It has execute permissions. I think it may have something to do with /root/.bashrc as i dont want the script to be executed as root, and the bash commands in the script seem to need access to /root/.bashrc.

I am wandering if there is something else that needs to happen because the shell information in the password file is (now) /usr/local/bin/scriptname instead of /bin/bash??

If i execute the script as root it works perfectly? Its only when i log in with a user that is set to run the script instead of /bin/bash??

Thanks again for your help.

Old 10-30-2003, 01:09 PM   #4
Registered: Oct 2003
Distribution: Slackware
Posts: 112

Rep: Reputation: 15
You probably don't want a generic login script trying to run /root/.bashrc. What you probably want to do is change the invocation of /root/.bashrc to $HOME/.bashrc.

If a user other than root logs in, the script can't run /root/.bashrc, which is private to root.
Old 10-30-2003, 04:15 PM   #5
Registered: Oct 2003
Distribution: Debian/unstable
Posts: 85

Rep: Reputation: 15
Don't you want an entry in .bashrc or .bash_profile to run the script every time the user logs in?

The script isn't an actual login shell, is it? If not, you don't want it listed in /etc/passwd.


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
bash login script bunnyknight13 Linux - Newbie 4 09-10-2004 09:02 PM
bash login script seanatis Programming 6 09-06-2004 09:00 AM
fastest way to execute another bash script ?? michael_util Programming 3 08-23-2004 11:04 AM
how to execute automatically a program/script after login mule Linux - General 8 12-13-2003 03:44 PM
How to execute script after login? gmitra Linux - General 2 02-19-2003 12:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:04 PM.

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