Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
When I login (using ssh) to CentOS 6.6 with an account configured to use /bin/bash, the shell does not read the .bashrc file located in $HOME.
I set the file permissions to 744, but it's still not reading the file and I have to manually issue ". $HOME/.bashrc" to get the contents loaded.
Any ideas on what I should be looking for to fix this problem?
When I login (using ssh) to CentOS 6.6 with an account configured to use /bin/bash, the shell does not read the .bashrc file located in $HOME.
With an interactive login shell it should be loading by default /etc/profile, then /etc/inputrc, then any /etc/profile.d/*.sh, then ~/.bash_profile and then ~/.bashrc. So what have you changed globally or locally since you've created the account?
Quote:
Originally Posted by usao
I set the file permissions to 744, but it's still not reading the file and I have to manually issue ". $HOME/.bashrc" to get the contents loaded.
It's sourced not executed, it should have max octal 0640.
With an interactive login shell it should be loading by default /etc/profile, then /etc/inputrc, then any /etc/profile.d/*.sh, then ~/.bash_profile and then ~/.bashrc. So what have you changed globally or locally since you've created the account?
It's sourced not executed, it should have max octal 0640.
AFAIK only the $HOME/.bashrc file has been changed. I created the account today. I can change perms to 640 and see if that makes any difference.
ls: cannot access /export/home/user/.bash_profile: No such file or directory
-rw-r--r--. 1 root root 942 Jan 12 2010 /etc/inputrc
-rw-r--r--. 1 root root 1796 Oct 2 2013 /etc/profile
-rw-r--r--. 1 root root 1143 Jul 16 2014 /etc/profile.d/colorls.sh
-rw-r--r--. 1 root root 192 Sep 9 2014 /etc/profile.d/glib2.sh
-rw-r--r--. 1 root root 2706 Nov 4 2014 /etc/profile.d/lang.sh
-rw-r--r--. 1 root root 121 Jun 4 2014 /etc/profile.d/less.sh
-rwxr-xr-x. 1 root root 153 Aug 22 2010 /etc/profile.d/mc.sh
-rw-r--r--. 1 root root 269 Apr 5 2012 /etc/profile.d/vim.sh
-rw-r--r--. 1 root root 169 May 20 2009 /etc/profile.d/which2.sh
-rwxr--r--. 1 user user 1228 Sep 8 14:44 /export/home/user/.bashrc
So /export/home/user/ doesn't have any .bash_profile. NP, BASH should be able to function without it except:
Code:
~]$ head -4 .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
Ah, wasn't aware there was a requirement for .bash_profile. I though BASH automatically sourced the $HOME/.bashrc.
So, in reality, BASH sources .bash_profile, so I could just put my stuff in there instead of .bashrc.
A login shell (interactive or non-interactive) sources /etc/profile and then looks for ~/.bash_profile, ~/.bash_login, and ~/.profile in order, and sources the first one it finds.
An interactive non-login shell sources ~/.bashrc.
The "INVOCATION" section of the bash manpage spells this out in great detail.
It is very common for ~/.bash_profile to have a line that explicitly sources ~/.bashrc, but that is the only way that your .bashrc gets routinely sourced by a login shell.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.