Bash – Where do /root/.bashrc and /root/.profile come from on a Debian system

bashrcdebianprofileroot

Normally when you add a user on a Debian system, the contents of /etc/skel/ are copied into the new user's home directory. But /root/.bashrc does not match /etc/skel/.bashrc and /root/.profile does not match /etc/skel/.profile. Also neither file is known to dpkg. So where do they come from?

Best Answer

root's files are copied from base-files: if they're missing, its postinst copies /usr/share/base-files/dot.bashrc to /root/.bashrc and /usr/share/base-files/dot.profile to /root/.profile. Additionally, if /root/.profile matches one of the recorded checksums (which means it hasn't been changed by the administrator), it is updated on upgrade.

The same applies to /etc/profile and /etc/nsswitch.conf (including updating on upgrade), and /etc/motd.

Related Question