Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am not too familiar with this level of management on a nix server however I am unable to get either the bashrc or bash_profile to source at login.

Details about the server:

  • Centos 6.0 - Basic GUI installation
  • Virtualmin Server Manager

I am logging in as a user I created in the Virtualmin module through ssh and putty from my windows pc. The .bash_profile has the following in it:

 PATH=$PATH:$HOME/bin
 export PATH

I've created a bin directory in that user's home and placed my application inside however upon log out and log in there is no change. I've tried adding the same two lines in the bashrc file as well when I saw that it wasn't working in the bash profile.

So far I can remedy the situation by typing source .bash_profile but that is tedious. I thought I could save some time by making a bash shell script but alas i cannot simply type in ./script.sh I must type source ~/script.sh in order for it to be effective under the current shell.

How do I get these scripts to load? Is it that virtualmin disables the user profiles? Is logging in via ssh preventing them from loading? Is it that installing Centos 6 with a gui disables profiles loading in terminals regardless of them being tunneled through ssh?

Thank you for the help.

Full contents of Bash Profile:

 # .bash_profile

 # Get the aliases and functions
 if [ -f ~/.bashrc ]; then
         . ~/.bashrc
 fi

 # User specific environment and startup programs


 PATH=$PATH:$HOME/bin
 export PATH
share|improve this question
1  
Check your .bash_profile, what does this file contain? Also, is the shell for the user really bash? –  johnshen64 Mar 26 '12 at 17:45
    
I added the full output of the .bash_profile for this user. I do not know how to check if the shell for the user is bash. Until I get the source the username is "-sh-4.1$ " once I get the source it changes to what I expect "user@computername ~]$ " –  Mallow Mar 26 '12 at 18:21
1  
One way to see your shell, do grep yourusername /etc/passwd. –  Stefan Lasiewski Mar 26 '12 at 18:23
1  
things look fine, so checking the shell would be important. grep above would work. also, if you are logged in as the user, you can use echo $SHELL –  johnshen64 Mar 26 '12 at 18:32
add comment

1 Answer

up vote 2 down vote accepted

There are a whole lot of questions here that you have, and not much information provided for us to go on. But, here are some attempts:

The first thing I'd check is to see if your PATH is getting set at all when logging in. To check that, login to the terminal and type echo $PATH. If the things you added are there, then great, on to the next problem. If they aren't there, then I'd verify you are actually running bash with echo $SHELL. If you are, can you check if ANYTHING in ~/.bashrc or ~/.bash_profile is getting set? I'd find something innocuous and change it, then logout and back in to see if it took effect (or just add something like FOO="bar";export FOO, then test it after login with echo $FOO). If your .bashrc and .bash_profile aren't getting run, I'd check to see if .profile is getting run, and then also check if /etc/profile and /etc/rc/bash.bashrc are there and are calling the user's profiles correctly.

If you find that things are actually getting into .bash_profile, then I'd check to make sure your script and the directory it is placed in has the appropriate permissions, is executable, and that the directory is actually in your path (maybe something else is setting the path variable after you set it and overwriting your changes?).

If none of that works, then please post the following here and maybe we'll be able to see something more:

env
echo $SHELL
echo $PATH
cat ~/.bashrc
cat ~/.profile
cat ~/bash_profile
cat /etc/profile
cat /etc/bash.bashrc
share|improve this answer
    
When I saw your reply I thought, "wow, this is extreme overkill for such a simple feature" maybe I should have included it was a clean install. Anyways you got me thinking, did a search for vitualmin bash profiles and you were right, I wasn't running bash. For anybody with similar issues check here: virtualmin.com/node/12655 –  Mallow Mar 26 '12 at 21:25
add comment

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.