Operating System - HP-UX
1846204 Members
4223 Online
110255 Solutions
New Discussion

Re: environmental variable setting for sudo user

 
SOLVED
Go to solution
bharani123
Occasional Advisor

environmental variable setting for sudo user

The user is using "sudo -s" to become root.But when he become super user his environmental variable HISTFILE not getting set.And each time he is forced to run #export HISTFILE=/home/user1/.sh_history -- To access his command history. Can any one say how to set Environmental variable for this sudo user, so that it will be remain permanent.The entry in /home/user1/.profile haven't helped.
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: environmental variable setting for sudo user

This seems like a security problem bound to happen if you want to share it.

But there are options in sudo to retain environment vars.
bharani123
Occasional Advisor

Re: environmental variable setting for sudo user

Dennis can i have the option which have to be used with sudo so that user will retain his own environmental variable setting.
balalingam
Occasional Contributor

Re: environmental variable setting for sudo user

the user is setting the environmental variable because "when he became superuser he is unable to access his command history".There the requirement is user should be able to access his own command history.
balalingam
Occasional Contributor

Re: environmental variable setting for sudo user

the user is setting the environmental variable because "when he became superuser he is unable to access his command history".here the requirement is user should be able to access his own command history.
Dennis Handly
Acclaimed Contributor
Solution

Re: environmental variable setting for sudo user

See the documentation, -E:
http://www.sudo.ws/sudo/man/sudo.html
bharani123
Occasional Advisor

Re: environmental variable setting for sudo user

Thanks Dennis..