How to set env variable for all process?

0

I'm working on Linux,

Can anybody please help me to set a env variable on Linux that will be available for all process running on the same machine?

BSalunke

Posted 2012-10-04T07:54:44.190

Reputation: 113

Not programming related. – Burhan Khalid – 2012-10-04T07:58:38.327

Answers

0

You have to write the definition of your env variable into /etc/profile :

VARIABLE=content

If that doesn't work, you could try /etc/environment

FSMaxB

Posted 2012-10-04T07:54:44.190

Reputation: 1 528

That won't reach all processes, only those started from a users shell. – None – 2012-10-04T08:00:32.060

I added /etc/environment – FSMaxB – 2012-10-04T08:11:59.383

Sounds better, though it depends on the PAM configuration. I wonder if it is possible to hand that environment variable to the init process. All other processes are started by that one, so they all inherit that variable. – None – 2012-10-04T09:18:05.443