62
rated 0 times
[
62]
[
0]
/ answers: 1 / hits: 117787
/ 1 Year ago, sun, april 23, 2023, 9:11:14
To create persistent environment variables, I add the script file to /etc/profile.d directory, for example:
# my script
export MY_VAR=var_value
This works properly for current user:
alex@alex-64:~$ echo $MY_VAR
var_value
Now I need the same environment variables for the root user, but /etc/profile.d script doesn't work for root:
alex@alex-64:~$ echo $MY_VAR
var_value
alex@alex-64:~$ sudo su
root@alex-64:/home/alex# echo $MY_VAR
root@alex-64:/home/alex#
How can I set the same variables for the root?
More From » root