LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-22-2003, 02:04 PM   #1
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Rep: Reputation: 15
log on not reading user's .bashrc


I brought up a new linux OS while retaining the home partition from the old one. When I mounted this home partition and created the same user accounts, the users could not access their old home directories because their user numbers had changed. I probably should have just editted the /etc/groups and /etc/passwd entries. But I tried something else instead: I used chown -R on each of the home directories to the user. That fixed the access problem.

But a new problem has emerged. When a normal user logs on, his .bashrc file is not parsed. Does anyone have any idea what I've hosed up here?

Thanks.
-Jeff
 
Old 05-22-2003, 02:08 PM   #2
fancypiper
Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
Are you talking Red Hat? If so, make sure this is at the bottom:
Code:
# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi
 
Old 05-22-2003, 02:24 PM   #3
jkcunningham
Member
 
Registered: May 2002
Location: Seattle, WA, USA
Distribution: Gentoo
Posts: 136

Original Poster
Rep: Reputation: 15
Put it at the bottom of what? The user's ~/.bashrc? But that file isn't being read. I think the global /etc/bashrc is.

Its a gentoo system.
 
Old 05-22-2003, 02:35 PM   #4
fancypiper
Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
Did you try doing usermod -s bash for each user? Perhaps their shell isn't set.
 
Old 05-22-2003, 02:56 PM   #5
abyss
Member
 
Registered: May 2001
Location: New York, USA
Distribution: AIX, Ubuntu
Posts: 113

Rep: Reputation: 15
code:-------------------------------------------------------------------------
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
--------------------------------------------------------------------------------

That should be at the end of your .bash_profile

.bash_profile in your home directory is what sources the .bashrc

Are the permissions on your .bash_profile and .bashrc correct?

Should be 644

chmod 644 .bash_profile

chmod 644 .bashrc

HTH
 
Old 05-15-2010, 12:17 PM   #6
take2hikes
LQ Newbie
 
Registered: May 2010
Posts: 16

Rep: Reputation: 0
abyss - I know this is an old thread, but your response helped me and I've been working on the bashrc file not loading for a couple days.

I am a bit curious though, once I added the .bash_profile with the lines you mentioned, my user bashrc was loaded just fine. However before I did that (and still), if I go su it loads up the .bashrc file and there is no .bash_profile for the root account.

Why is this?
 
Old 05-15-2010, 01:02 PM   #7
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,131

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
The .bashrc file is only sourced on non-login shells (like when you do su -- I believe "su -" opens a login shell). The .bash_profule script is sourced on login shells, so many people (including me) just have .bash_profile source .bashrc so they get the same environment regardless of whether the shell is a login or non-login shell.
 
Old 05-15-2010, 02:18 PM   #8
take2hikes
LQ Newbie
 
Registered: May 2010
Posts: 16

Rep: Reputation: 0
That is what I believe I did, finally. At least with my user account. I created a .bash_profile under the ~/ directory and added the following lines to it:

Code:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
However, now when I boot up and try to log on under my normal account, I get the following error message:
Code:
Cannot execute bash: No such file or directory.
This forces me to login with the root account.

I'm not sure how this happened. It may have been when I edited the permissions for my user .bash_profile or .bashrc, but I can't be sure.

Permissions:
Code:
131455 -rw-r--r-- 1 aaron users 73 2010-05-15 13:14 /home/aaron/.bash_profile
131451 -rw-r--r-- 1 aaron users 2.0K 2010-05-14 23:49 /home/aaron/.bashrc
279722 -rw-r--r-- 1 root root 2.0K 2010-05-14 23:48 /root/.bashrc
(I do not have a .bash_profile under root)

Do you have any ideas what may have gone wrong here and/or how to fix it?

Thanks!

Last edited by take2hikes; 05-15-2010 at 02:26 PM. Reason: additions
 
Old 05-15-2010, 06:49 PM   #9
take2hikes
LQ Newbie
 
Registered: May 2010
Posts: 16

Rep: Reputation: 0
SOLVED.

The issue was in my /etc/passwd file. Somehow my user got changed to just :bash instead of :/bin/bash.

Fixing this corrected the issue. Thank you for the efforts!
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
restrict a user's access to mail reading only? ksgill Linux - Newbie 2 11-22-2005 01:54 PM
Reading Log files with NetTracker PensJunkie Linux - Software 2 07-30-2005 09:11 AM
Reading other user's home directory with Samba zupidupi Linux - Networking 7 04-14-2005 01:53 AM
Help reading Error Log (messages) micxz Linux - Networking 2 09-27-2003 03:52 AM
Log file reading Garak Linux - General 5 07-08-2003 06:55 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration