Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
12
rated 0 times [  12] [ 0]  / answers: 1 / hits: 23022  / 2 Years ago, fri, april 22, 2022, 9:48:30

On one of my Ubuntu 11.10 servers, when I use sudo -i to become the root user, root's .bashrc is not being executed. On all other servers, whose relevant configurations are identical as far as I know, it is being executed properly.



Here's what I've checked:




  • .bashrc exists in /root, owned by root:root, permissions 644

  • /etc/profile and /etc/bash.bashrc are being executed

  • root's shell is set to "/bin/bash"

  • I can execute .bashrc with source .bashrc, after which everything is normal for that session.

  • I can also type bash to execute bash manually after I've sudoed to root, and .bashrc is then executed

  • ps confirms that the running shell for my root login is bash.



Anything else to check?


More From » 11.10

 Answers
3

You should look at the presence and content of the file /root/.profile.



The init file ~/.bashrc is not sourced in login shells: on Ubuntu it is sourced from ~/.profile



Furthermore, the file /root/.profile is not copied from /etc/skel/ as for other users, it is instead copied from /usr/share/base-files/dot.profile during installation of package base-files.


[#40645] Sunday, April 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dersol

Total Points: 78
Total Questions: 100
Total Answers: 124

Location: Christmas Island
Member since Mon, Oct 19, 2020
4 Years ago
;