I'm used to use sudo -i
and don't have a root
password set, i.e. su -
doesn't work. I'm looking for a way to share bash
aliases between a user shell (e.g. the one opened when I start gnome-terminal
started as the user who logged into the display manager) and the shell opened by sudo -i
.
According to man sudo
it's a login shell and afaik it should source ~/.profile
, i.e. /root/.profile
, but putting aliases in /root/.profile
doesn't work. Only if I run bash
in the shell opened by sudo -i
the alias is available. According to /etc/passwd
root
's shell is bash
and SHELL
variable confirms that (in the shell started by sudo -i
).
I'd prefer to not put the aliases in /etc/profile
because that would expose them to any user and I only want to have them for the display manager user and root
.
/etc/bashrc
nor/root/.profile
is read, i.e. alias isn't available which I think is a bug. Adding to/etc/profile.d/00-aliases.sh
works. Thank you. – Kalle Richter Aug 11 '16 at 02:51