How to get su to default to a login shell?

Hey all,

How can I get su/sudo to load the user environment by default and get a login shell?

Looking to replicate the way su & sudo work on debian/ubuntu. Currently if I `sudo su` or `su user` I get a non-login shell, any aliases I may have set on the user are not present, and my prompt is still root's prompt (except for the username)

I have alias sudosu="sudo su -" in /usr/local/etc/profile and that works for switching to root from a user account on the base system. But pushing this out to jails is a PITA and it only works one way. It would be nice to set this up without having to create individual aliases.

Further, I am setting up a rails app in a jail and rvm complains about not having a bash login shell. `su - rails` from root gets around that but I don't really want to have to remember to do the -.

Thanks!

Tom
 
Thanks but that doesn't really answer the question.

I did find a (painfully obvious) solution... just alias su="su -"
 
Back
Top