You are not logged in.

#1 2009-04-25 13:26:13

lumbar
Member
Registered: 2009-04-17
Posts: 8

root-shell doesn't source /root/.bashrc

Moin

When I change to the root user the bashrc is not sourced. No matter if I "su -" or login as root, the /root/.bashrc is not source. I need to manually type "source ~./.bashrc".

On all other Linux-distros I ever used this was done automatically.

How can I change this behavious?

Thanks in advance.

Offline

#2 2009-04-25 13:44:34

stabele
Member
Registered: 2008-12-22
Posts: 101

Re: root-shell doesn't source /root/.bashrc

I am not 100% sure, but I suppose that after "su -" is bash invogen in login mode. In that case it uses ~/.bash_profile - do you have this file in home and is line ". $HOME/.bashrc" inside ?

Offline

#3 2009-04-25 17:13:43

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: root-shell doesn't source /root/.bashrc

yes, "su -" invokes a login shell. source ~/.bashrc from ~/.bash_profile or ~/.profile, as stabele suggested. See man bash for the gory details about rcfile loading.

Offline

#4 2009-04-25 18:33:39

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: root-shell doesn't source /root/.bashrc

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

in your ~/.profile

Offline

#5 2009-04-27 11:34:33

lumbar
Member
Registered: 2009-04-17
Posts: 8

Re: root-shell doesn't source /root/.bashrc

It works, thank you very much. big_smile

Shouldn't this be the default behaviour?

Offline

#6 2009-04-27 13:34:41

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: root-shell doesn't source /root/.bashrc

no

edit: But it is customary to `. ~/.bashrc` in ~/.bash_profile

Last edited by Mr.Elendig (2009-04-27 13:35:23)


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#7 2009-04-27 13:54:26

dmartins
Member
Registered: 2006-09-23
Posts: 360

Re: root-shell doesn't source /root/.bashrc

both .bashrc and .bash_profile are available from /etc/skel. Usually, the contents of this directory are copied to a new user's home directory when using the useradd command. I'm not sure why they're not added to the /root directory on a fresh install. The answer is probably on the arch-dev-public mailing list.

Offline

Board footer

Powered by FluxBB