You are not logged in.

#1 2009-10-01 17:10:54

dabd
Member
Registered: 2008-11-17
Posts: 109

Using /etc/bash.bashrc to set system-wide alias

Hi,

I would like to set some system-side aliases and from what I read /etc/bash.bashrc is the correct place to put them.
However, it seems that the root account doesn't load this file. 

What is the correct way to define system-wide aliases?

Thanks.

Offline

#2 2009-10-01 17:28:27

dabd
Member
Registered: 2008-11-17
Posts: 109

Re: Using /etc/bash.bashrc to set system-wide alias

To be more specific, the aliases are not visible when I use a login shell i.e. 'su -'.
According this explanation http://stefaanlippens.net/bashrc_and_others this is correct. 

So, do I need to duplicate the aliases in /etc/profile so they are visible from login shells?  Or there is a way to define system-wide aliases for
login and non-login shells?

Thx.

Offline

#3 2009-10-01 18:01:45

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Using /etc/bash.bashrc to set system-wide alias

dabd wrote:

So, do I need to duplicate the aliases in /etc/profile so they are visible from login shells?

you could source /etc/bash.bashrc from /etc/profile.  just like ~/.bash_profile usually sources ~/.bashrc

Offline

#4 2009-10-01 21:03:17

dabd
Member
Registered: 2008-11-17
Posts: 109

Re: Using /etc/bash.bashrc to set system-wide alias

Initially I created .bash_profile and .bashrc for root and in the latter I was sourcing /etc/bash.bashrc but your solution is simpler.
Thanks.

Last edited by dabd (2009-11-11 09:29:34)

Offline

Board footer

Powered by FluxBB