Solved

HP-UX

Posted on 2013-02-01
6
222 Views
Last Modified: 2013-02-06
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?
0
Comment
Question by:chima
6 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 38845647
sudo su xxx

Without hyphen
0
 
LVL 31

Expert Comment

by:farzanj
ID: 38845648
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
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 250 total points
ID: 38845653
"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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 40

Accepted Solution

by:
omarfarid earned 250 total points
ID: 38845849
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
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 38846801
A bit late but how about a good old "man su"for starters? It's all there :D
0
 

Author Closing Comment

by:chima
ID: 38861872
gerwinjansen, I pay a membership fee!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now