I'm trying to set up a sane/usable environment in a barebones OpenSolaris-derivative (OmniOS, a distribution of Illumos/OpenIndiana). I have all the plumbing code I need in .profile, .inputrc, and .bashrc files ready to promote to system-wide use, but no system-wide scripts are being sourced for non-login shells. Bash attempts to load the user's .bashrc file on su, but $HOME (and any other environment variables) remains configured for the previous user.
Output from a direct (SSH) login:
login as: myuser
Using keyboard-interactive authentication.
Password:
/etc/profile run
myuser's .bashrc run
myuser's .profile run
myuser@Helios:~$ echo ~
/home/myuser
myuser@Helios:~$
Output switching user:
root@Helios:/etc# su myuser
bash: /root/.bashrc: Permission denied
bash-4.2$ id
uid=1001(myuser) gid=100(users) groups=100(users),27(sudo)
bash-4.2$ echo ~
/root
bash-4.2$
Note in particular the attempt to source root's .bashrc instead of myuser's .bashrc.
su (without additional arguments) has always worked seamlessly in Ubuntu, Fedora, etc. and I intend to replicate that experience, but what can I do when no system-wide scripts run and the user's scripts cannot be found? I'm inclined to blame OmniOS's version of bash and/or su for missing something, but what exactly is the correct behavior? Can I configure/access/script additional plumbing somewhere which addresses the failure to update $HOME and other envvars?
Further notes:
- there is no man bash in OmniOS (at least not using MANPATH=/opt/omni/share/man:/opt/mysql55/man:/opt/gcc-4.4.4/man:/usr/gnu/share/man:/usr/local/man:/usr/local/share/man:/usr/man:/usr/share/man)
- /etc/bashrc and /etc/bash.bashrc never get sourced (which is expected as this is apparently a distribution-specific convention, but Ubuntu does appear to be loading these without reference from .bashrc)