Question: Why doesn't -H work?

Todd C. Miller Todd.Miller at courtesan.com
Wed Oct 15 21:11:55 EDT 2003


In message <E5C7DFBD68DDD21194140004ACB89C53139EA25C at gwmail1.gwl.ca>
	so spake "Malton, Craig" (Craig.Malton2):

> Hello, 
>     I'm trying to run some commands as so 
> 
> sudo -H -u db2as echo $HOME 
> 
> I'm running this as user cmalton and $HOME keeps returning as
> /home/cmalton not /export/home/db2as.  Does anyone know why -H isn't
> working for me?

Your shell is expanding $HOME before sudo runs.  Try this:
    sudo -H -u db2as printenv HOME

 - todd


More information about the sudo-users mailing list