How to keep environment variables when sudo in RHEL5

Mike Burger mburger at bubbanfriends.org
Mon Mar 16 13:59:04 UTC 2009


> Hello,
>
> I have problem whit keeping the environment variables when I running
> "sudo -s" in RHEL 5.
> The variables I get when I login whit my user is set in /etc/profile , but
> are lost when I running "sudo -s"
>
> [linus at server03 ~]$ export |grep PATH
> declare -x
> PATH="/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin:/opt/appl/ground/services/bin:/opt/ground/appl_log/tools"
> [linus at server03 ~]$
>
> [linus at server03 ~]$ sudo -s
> [root at server03 ~]# export |grep PATH
> declare -x PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/bin:/bin"
> [root at server03 ~]#
>
> What should I do to keep them?

Add those items to the root user's profile, as well.
-- 
Mike Burger
http://www.bubbanfriends.org

Visit the Dog Pound II BBS
telnet://dogpound2.citadel.org or http://dogpound2.citadel.org

To be notified of updates to the web site, visit:

https://www.bubbanfriends.org/mailman/listinfo/site-update

or send a blank email message to:

site-update-subscribe at bubbanfriends.org




More information about the redhat-list mailing list