Hi folks. Just wondering how I can implement an automatic .bash_profile for root. I have to load my user .bash_profile every time I get into root, and I would like a better solution. There is no /home/ for root, so I?m a bit confused if this is even allowed. Any insight appreciated. Cheers, Bee
Hi, The $home of root is /root, just copy it there. -- Sent from the Delta quadrant using Borg technology! Nux! www.nux.ro ----- Original Message -----> From: "Bee.Lists" <bee.lists at gmail.com> > To: "CentOS mailing list" <centos at centos.org> > Sent: Monday, 13 May, 2019 13:28:24 > Subject: [CentOS] root .bash_profile?> Hi folks. Just wondering how I can implement an automatic .bash_profile for > root. I have to load my user .bash_profile every time I get into root, and I > would like a better solution. There is no /home/ for root, so I?m a bit > confused if this is even allowed. > > Any insight appreciated. > > > Cheers, Bee > > > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos
On Mon, 2019-05-13 at 08:28 -0400, Bee.Lists wrote:> Hi folks. Just wondering how I can implement an automatic .bash_profile for root. I have to load my > user .bash_profile every time I get into root, and I would like a better solution. There is no /home/ > for root, so I?m a bit confused if this is even allowed. > > Any insight appreciated. > > > Cheers, Bee >For a "normal" installation root's home directory is /root>From a users account the "-" will source /root/.bash_profileand change to root's home directory. ja at naxos ~ 1$ su - Password: [root at naxos:~]$ pwd /root [root at naxos:~]$ For the occasions when it is desirable NOT to cd /root I have an alias in /root/.bashrc alias sbp='source ~/.bash_profile' ja at naxos ~ 2$ pwd /home/ja ja at naxos ~ 3$ su Password: root at naxos ja 1001$ pwd /home/ja root at naxos ja 1002$ sbp [root at naxos:/home/ja]$ pwd /home/ja /root/.bash_profile changes the colour of the prompt (among other things) PS1="\[\033[1;31m\][\u@\h:\w]$\[\033[0m\] " There must be much better ways of doing this!
On Mon, 13 May 2019 at 08:28, Bee.Lists <bee.lists at gmail.com> wrote:> Hi folks. Just wondering how I can implement an automatic .bash_profile > for root. I have to load my user .bash_profile every time I get into root, > and I would like a better solution. There is no /home/ for root, so I?m a > bit confused if this is even allowed. > >Most Linux distributions since the mid 1990's have made /root the home directory for their UID 0 user. This was because /home was not guaranteed to be mounted when the system started up AND people were annoyed with the Unix tradition of having UID 0 with the / as the home directory. [Having UID 0 with / caused all kinds of file components to show up in / and sometimes with the worst permissions.. so any user might source through /.history and find some password etc.] While moving /root to /home/root is done in someplaces, it only works if /home is not on a different partition. If you put /home on a different partition you will find all kinds of weird behavior happening on start up.> Any insight appreciated. > > > Cheers, Bee > > > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >-- Stephen J Smoogen.
On 2019-05-13 07:38, Nux! wrote:> Hi, > > The $home of root is /root, just copy it there.It is $HOME not $home ;-) Valeri> > -- > Sent from the Delta quadrant using Borg technology! > > Nux! > www.nux.ro > > ----- Original Message ----- >> From: "Bee.Lists" <bee.lists at gmail.com> >> To: "CentOS mailing list" <centos at centos.org> >> Sent: Monday, 13 May, 2019 13:28:24 >> Subject: [CentOS] root .bash_profile? > >> Hi folks. Just wondering how I can implement an automatic .bash_profile for >> root. I have to load my user .bash_profile every time I get into root, and I >> would like a better solution. There is no /home/ for root, so I?m a bit >> confused if this is even allowed. >> >> Any insight appreciated. >> >> >> Cheers, Bee >> >> >> >> >> _______________________________________________ >> CentOS mailing list >> CentOS at centos.org >> https://lists.centos.org/mailman/listinfo/centos > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >-- ++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
Ah thank you. Having forgotten this, I already had all my aliases and instructions in there. For some reason they aren?t loading. If I do this, then everything loads: source /root/.bash_profile So there?s an indication this isn?t loading upon entry into su. Is this normal?> On May 13, 2019, at 8:38 AM, Nux! <nux at li.nux.ro> wrote: > > Hi, > > The $home of root is /root, just copy it there.Cheers, Bee
OK, I haven?t tested for that loadup yet, and the .bashrc is indeed there. I thought .bashrc was loaded first, then .bash_profile. This is for normal user. Just tested it again, and /root/.bash_profile is not loading. Tried this in /root/.bashrc: source /root/.bash_profile That created a loop, because that reverse instruction is inside /root/.bash_profile So for some reason, entering su isn?t loading its own .bash_profile nor keeping my user?s .bash_profile (expected). Any ideas?> On May 13, 2019, at 8:49 AM, ja <ja at jaa.org.uk> wrote: > > I have an alias in /root/.bashrc > alias sbp='source ~/.bash_profile' >Cheers, Bee
No, this isn?t a case of multi partitions, clusters, or anything silly. I just want a set of aliases loaded for su. /root/.bash_profile isn?t loading, and there isn?t any obvious choice as to where the loaded .bash* were loading from.> On May 13, 2019, at 9:11 AM, Stephen John Smoogen <smooge at gmail.com> wrote: > > While moving /root to /home/root is done in someplaces, it only works if > /home is not on a different partition. If you put /home on a different > partition you will find all kinds of weird behavior happening on start up.Cheers, Bee