Gentoo Archives: gentoo-user

From: "Jesús Guerrero" <6thpink@×××××.es>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] .bashrc/.bash_profile not "sourced" upon login fo NIS authenticated users
Date: Wed, 28 Mar 2007 08:27:49
Message-Id: 20070328102235.0a6e9871@pinkroom
In Reply to: [gentoo-user] .bashrc/.bash_profile not "sourced" upon login fo NIS authenticated users by Bob Young
1 El Wed, 28 Mar 2007 00:44:45 -0700
2 "Bob Young" <RKY@×××××.Net> escribió:
3
4 > Probably a PEBSAC
5 >
6 > If so, that's ok I'm willing to learn. Like the title says, if I log
7 > in as root /root/.bashrc and /root/.bash_profile are sourced. However
8 > if I login as BYoung and am authenticated by the NIS server (SFU on
9 > aWindows Domain Controller), then /home/BYoung/.bash_profile
10 > and /home/BYoung/.bashrc are not sourced. As workaround, I've added:
11 > "source ~/.bash_profile" as the last line of /etc/profile, and that
12 > works, but of course .bash_profile and .bashrc get executed twice
13 > when I log in as root.
14 >
15 > I'd like to fix this the right way, pointers and/or advice greatly
16 > appreciated, and if I'm just doing something stupid, let me know.
17 >
18 > TIA
19 > Bob Young
20 > San Jose, CA
21 >
22
23 I don't know exactly what happens here, but have you tried
24 ~/.bash_login and ~/.profile ? They are sourced when bash is run as
25 interactive login shell. Also, to completely discard any silly mistake,
26 can you source them by hand when you are logged?
27
28 Note that bashrc is not sourced on non-loging shells, so it is not
29 relevant here. Are you sure as root it is sourced? It would greatly
30 surprise me. That is, unless you have them symlinked, sourced from
31 withing each other or something.
32
33 As spoken by the bash man page, and my own experience, on login shells,
34 bash sources /etc/profile, and then, in this order, one of
35 ~/.bash_profile, ~/.bash_login and ~/.profile . ONLY ONE of between
36 these three files, the one that is found first, in that same order. The
37 others are discarded, even if they exist. So, be sure you don't have
38 any empty .bash_profile that is blocking the other two.
39
40 On non-login shells, the thing is easier, both /etc/bash/bashrc
41 and /home/6thpink/.bashrc are sourced if found. And NONE of the files
42 sourced by a login shell is sourced by a non-login one.
43
44 -- Jesús Guerrero
45 --
46 gentoo-user@g.o mailing list