Help with sudo

Dana Kaempen decay at
Sat May 24 02:59:23 EDT 2003

Thus penned Stephen:
>     I'm lost and need help.  I am trying to replace su with sudo in an HP-UX
> 11.0 environment.  My problem is getting the environment set.  Currently
> users logon to oracle directly or us su - oracle.  This setups a host of
> aliases and environment variables.  How can I get the same environment with
> sudo?
>     I have tried using -H, -s with env -i ENV=...  and cannot get the
> environment.  There has to be a way to do this.  Can someone please help.
The easiest way to get the environment of the oracle user when using sudo 
(provided sudo does *not* source in the user's profile) is to manually "dot 
in" the items which customize that user's environment, such as the 
.profile, .kshrc, .netrc, .exrc, etc.  If you notice, cron jobs for a 
specific user do *NOT* do this, so we always explicitly dot in whichever 
tailoring is necessary.

In sudo, to make your life easier, you'll probably want to do this 
customization in a script and have your sudo command run the script.  That 
way, you can test & customize it very easily and not need to change your 
sudo entry.

Good luck!



mailto:decay at
"Keep the wheels rolling." - Anonymous traffic prophet

More information about the sudo-users mailing list