Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
1  
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
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.