[英]Ubuntu global variable works only for root
I am added variable in /etc/environment
, but after restarting variable sets only for root, other users need execute source etc/environment
or they don't get any value: 我在
/etc/environment
添加了变量,但是仅在为root重新启动变量集之后,其他用户需要执行source etc/environment
或他们没有得到任何值:
user: echo $VAR
# blank
root: echo $VAR
value
(I know we can set up variables per user, but in my case I need global variable for all users.) (我知道我们可以为每个用户设置变量,但就我而言,我需要为所有用户设置全局变量。)
try /etc/profile
or /etc/bashrc
尝试
/etc/profile
或/etc/bashrc
check this answer: https://stackoverflow.com/a/1641494/1654077 检查此答案: https : //stackoverflow.com/a/1641494/1654077
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.