Bash – Both bashrc and bash_profile won’t seemingly source? VirtualMin Clean install

bashcentos6pathshellsource

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

Best Answer

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