General
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with su - username / Not going to home directory

SOLVED
Go to solution
D. Jackson_1
Honored Contributor

Problem with su - username / Not going to home directory

Hello all -
Small problem that I am stuck with.
I am currently logged in as root under /(root), I issue a su - username it logs me in with this ID but when I issue a pwd as this ID I am currently in the /(root) filesystem and not my home destination. I cannot change out of this directory /(root) (which is okay).
This is giving us problems on two accounts.

Users configured with SAM and given a different location for home directory (/home/penac/outbound/executrack).

Can anyone help?

TIA
3 REPLIES
Stuart Browne
Honored Contributor
Solution

Re: Problem with su - username / Not going to home directory

User configured with SAM?

Are you sure you're not after the HP-UX General group?

In any case, I'd start checking things like whether the user's directory does exist, and to ensure that when you are issuing 'su', you are also using the - between it and the username (ie. 'su - username'). The - indicates that it should inherit the new user's environment (ie. home dir etc.). Is kinda important.

Anyway.. just a bouncing point from a Linux guy..
One long-haired git at your service...

Re: Problem with su - username / Not going to home directory

check "/etc/passwd" entry for username.
Typically for root it would look something like this:
root:x:0:0:root:/root:/bin/bash

where "/root" is home directory.

Changing that should cause "su -" or any other form of login, to place you in whatever directory you specify.

Ex:
root:x:0:0:root:/home/root:/bin/bash

Just make sure the directory you specify excists. But if not, you sould receive an error saying so.
D. Jackson_1
Honored Contributor

Re: Problem with su - username / Not going to home directory

Thanks Guys for responding. I did put this in the wrong section of the forums.