Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Whenever I su to user X, it always starts in user Y home directory. The biggest issue is that then X doesn't run its .bash_profile, it attempts Y's and fails. I'm guessing it's just a typo in how the user was defined, but don't know where that is. This is on Red Hat.

How do I change the user's starting directory or otherwise fix these symptoms?

share|improve this question
are you doing su <user> or su <user> - ? – Zypher Dec 21 '10 at 18:38
@Zypher I was just doing su X – Adam Dec 21 '10 at 18:41
The option below leads me to believe the problem is that I logged in as user Y, and was in his home. Did some stuff from there and was looking to switch to user X with X's full profile. The -l flag provides the behavior I was expecting – Adam Dec 21 '10 at 18:43
You should mark it answered, then ;) – Jeff Ferland Dec 21 '10 at 19:03
I had to wait 10 min. ;) – Adam Dec 21 '10 at 19:43
up vote 3 down vote accepted

Try su -l $userX to, "Provide an environment similar to what the user would expect had the user logged in directly."

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.