HP-UX

Hello,
This is my problem; when I use sudo su - xxx, then when I exit,  I end up at the xxx home directory.  How could I exit sudo and remain at the directory I am at?
chimaAsked:
Who is Participating?
 
omarfaridConnect With a Mentor Commented:
when you su to another user and exit you go back to the same dir you where in, it can't be the same dir of that user or last one before you exit.

check with command id what is the current user you use
0
 
farzanjCommented:
sudo su xxx

Without hyphen
0
 
farzanjCommented:
Hyphen is meant to also get the home directory and environment of the new user.  If you skip that, you are in your own directory and your own environment.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
woolmilkporcConnect With a Mentor Commented:
"su -" starts a new login shell, and after exiting from this shell you're back where you came from.
This behaviour cannot be changed.
It doesn't matter whether su - was started via sudo or directly.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
A bit late but how about a good old "man su"for starters? It's all there :D
0
 
chimaAuthor Commented:
gerwinjansen, I pay a membership fee!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.