set a global environment variable in linux that sticks when going root
Posted
by
Scott
on Super User
See other posts from Super User
or by Scott
Published on 2011-06-25T05:04:58Z
Indexed on
2011/06/25
16:24 UTC
Read the original article
Hit count: 182
When I SSH into a linux box, I want to have the /etc/profile file save the results of the whoami
command to a global environment variable. if I were to go root with the command sudo su -
, I do not want that command to run again when gonig root, I want it to stick with the result of whoami
as my regular username from before I went root, and I need to access that variable as the root user even though it will run the /etc/profile file again when I go root. What can I do to only run that command once in the /etc/profile command?
© Super User or respective owner