Problem with sudo in Redhat 5
Hi Gurus,
I login as a user, do "sudo su", change to userid 'root' and add the value in .bash_profile. I exit after this, login as a user, sudo to root, but echo $variable does not show any value although the value of the variable exist in .bash_profile in root home directory (/root). Any help with is welcome. Thanks in advance. |
Hi,
Did you export the variable or just declare it? If you declare a variable in .bashrc/.bash_profile you should export it if you want to use it in login shells. Code:
export VARIABLE="value" Kind regards, Eric |
Thanks Erictra,
I declared the variable in .bashrc and it is working ! Lesson learnt: add vairables for users logging using sudo in .bashrc. |
Hello,
Nice! Also remember that if you didn't export the variable (you only mention declaring it), it will no be available in any sub-shells created. If you consider your problem solved then please mark your thread as such. Kind regards, Eric |
All times are GMT -5. The time now is 02:40 AM. |