At work our team uses a shared account "appadmin" to administer our application. At login, each one of us sources an "aliasrc" file containing his or her preferences. (aliases, display, prompt, …).
So far I do something like this:
normaluser$ su - appadmin
password:
appadmin$ . ~normaluser/.aliasrc
[superprompt: appadmin@machine]$
I am looking to reduce all this to a single command. So far I have replaced the use of su
by rlogin
in order to take advantage of .rhosts
and avoid having to input the password each time. (I know ssh is secure, but rlogin seems to be the standard around here).
Is there a way to source my aliasrc file as soon as I login in the shared account?
I don't insist on using rlogin
. If you have something better to suggest I am all ears (… well eyes :-/ ).
Hope I am clear enough.
Technical environment: Solaris 10, Ksh.
Best Answer
You want to add something to
~appadmin/.profile
or another login script that will load.aliasrc
based on who you were before switching users. The hard part is figuring out that username, since the usual methods aren't going to work:I think the easiest way is to figure out which tty you're on (with the
tty
command), and check which user owns it -- that should be the user you connected as:Then you can just make sure ~normaluser/.aliasrc exists, and source it if so: