Your problem is one of the many reasons I have stopped customising my personal environments on any and all of the (customer) servers that I manage. When you become frustrated and crippled when they're not consistently available such customisations lose their benefits IMHO.
Two different approaches to combat that:
- combine all your teams shell profile customisations, aliases and functions and make them available to all users by publishing them in for example
/etc/profile.d/
That has the benefit that you can create uniform work instructions and standardise approaches and avoids the situation where several versions of your_useful_shell_function
exist in different peoples ~/.bashrc that don't get updated when you discover and fix a bug / edge case / incompatibility.
To continue relying on customisations from your personal environment consider to:
- Set up an appropriate alias/function in your personal profile and train yourself to use that instead of
sudo -i -u root
. That alias or function can then run sudo -u root /bin/bash --rcfile ~ansible_usah/.bashrc
a and ensure that your personal bash RC file gets used instead of the default one for root. (or load a different personal bash rc-file that includes a subset/superset from the your customisations in your default ~/.bashrc)