|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
[Solved]Can anyone tell me why -H flag with sudo doesn't switch to the target user's home directory?
I have checked the man page ,which says : The -H (HOME) option sets the HOME environment variable to the homedir of the target user (root by default) as specified in passwd(5). By default, sudo does not modify HOME But I have tried below command: Code:
[root@shel0001 ~]# sudo -H -s -u wanglei [wanglei@shel0001 /root]$ pwd /root as you can see ,it still stays in the /root and doesn't change to user wanglei's home directory which is /home/wanglei, what am I missing ,please help me |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
It says "sets the HOME..." not goes to... Look: Code:
ran12:/home/vbe/admin/script $ sudo -H -u prod -s ran12:/home/vbe/admin/script $ id uid=1101(prod) gid=220(prod) groups=60(oper),300(dba),310(sas) ran12:/home/vbe/admin/script $ cd ran12:/prd/users/prod $ And so, it was set correctly as specified in the man pages... |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Solved] Unable to change/create home dir for particular user | fretagi | HP-UX | 8 | 09-19-2012 09:16 AM |
| sudo needs to source target user's .shrc | mp5802 | UNIX for Advanced & Expert Users | 2 | 08-11-2011 01:46 PM |
| How to switch user in shell scripting (without sudo)? | edgarvm | Shell Programming and Scripting | 8 | 01-08-2010 01:24 PM |
| Restricting SFTP user to a defined directory and home directory | sftpuser | Solaris | 1 | 10-16-2009 07:00 PM |
| Problem: Automounting Home directory for nis & nfs configuration doesn't work | pioneer | UNIX for Advanced & Expert Users | 0 | 10-18-2007 02:07 PM |
|
|