Elevating or changing your privileges to a different user always has this issue.
However, there's an easy fix for that instead of modifying it in /etc/profile or in /etc/bashrc
To become root with all the paths, aliases etc. associated with root run the following command:
or - if you're in the sudoers group - the following command:
Note the hyphen! This tells the shell to run the .<shell>rc of the user you are sudoing to. In case no username is given the shell interprets this as sudoing to the root user (first match in /etc/passwd = the lowest uid = root).
You can do this with all users on your system. Say you have a hardcore developer (username: harddev) on your system who has known UNIX forever and is used to the Korn shell (ksh) and has this setup as his default shell sudoing to his account with the hyphen (-) will give you all his privileges and the Korn shell including his paths, aliases etc. as your working shell.
Here's the command:
So now you're user harddev with a Korn shell and all his preferences set. If you're like me you don't like the Korn shell you can issue the following command:
this gives you all the privileges of user harddev BUT a regular Bash shell, however you will need to type in the full path of an executable.
hmmm but we don't like that... so we do a "sudo su - harddev" and run the command "bash" afterwards, this gives us the Bash shell with all the paths and aliases for that user.
Please note that for the sudo command it's easier if you're in the sudoers file. If you want to know how to put your account in the sudoers file, just ask and I'll explain.