LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Trying to execute bash script upon login?? (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-execute-bash-script-upon-login-110312/)

mr-d-2003 10-30-2003 04:57 AM

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.

Thanks,
Alan

acid_kewpie 10-30-2003 06:29 AM

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.

mr-d-2003 10-30-2003 08:56 AM

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.

Cheers,
Alan

musrum 10-30-2003 12:09 PM

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.

evil_Tak 10-30-2003 03:15 PM

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.


All times are GMT -5. The time now is 07:54 PM.