Questions tagged [environment-variables]

Environment variables are configuration options that can be set in a shell or other similar environments. All programs started from within the shell can read them and configure themselves.

Filter by
Sorted by
Tagged with
245 votes
13 answers
154k views

Environment variables of a running process on Unix?

I need to troubleshoot some problems related to environment variables on a Unix system. On Windows, I can use a tool such as ProcessExplorer to select particular a process and view values of each ...
Gant's user avatar
  • 2,595
228 votes
7 answers
475k views

How do you add a Windows environment variable without rebooting?

I would like to add an Environment variable to a Windows machine (desktop or server) and be able to use it without rebooting that machine. Say you have a production server which hosts a variety of ...
Chad Braun-Duin's user avatar
62 votes
4 answers
101k views

Can the environment variables tool in Windows be launched directly?

Is there a more direct way to the environmental variables GUI than the following? Right click 'My Computer' and select 'Properties'. Click 'Advanced System Settings' link. Click 'Advanced' tab. Click ...
JasonV.com's user avatar
42 votes
2 answers
88k views

CentOS /usr/local/lib system wide $LD_LIBRARY_PATH?

I install custom software in /usr/local/lib. How do I set the PATH and LD_LIBRARY_PATH in CentOS 6 system-wide to use /usr/local/lib. I realize there may be more than one way. What's the simplest and ...
unixman83's user avatar
  • 1,932
37 votes
5 answers
30k views

Is it possible to change value of $TERM when calling ssh?

On my local terminal, I have TERM=konsole-256color, but not all remote machine I connect to have this definition. Is it possible to make ssh change the TERM on remote machine? Without changing .bash* ...
user avatar
36 votes
8 answers
49k views

What is the best place to setup system wide environment variables on Linux?

I just want to setup a system wide environment variable, JAVA_HOME for all users, including root user. Requirements: accessible to normal users accessible to root always loaded, not only for bash (...
sorin's user avatar
  • 8,106
34 votes
4 answers
25k views

Use an environment variable in a launchd script

I'm curious if it's possible to specify an envrionment variable in the ProgramArguments portion of a luanchd script on Mac OS X Leopard. <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ...
matpie's user avatar
  • 473
33 votes
4 answers
75k views

crontab execution doesn't have the same environment variables as executing user

I ran my crontab job 0 2 */1 * * /aScript >aLog.log 2>&1 as a 'root' user, and however I found the env is different from env of the 'root' user, and therefore experiencing a different ...
Bamboo's user avatar
  • 435
32 votes
6 answers
43k views

Setting a variable for a given SSH host

In ssh_config, one can choose to export some environment variables to the host using SendEnv. Is there also a way to force a given value for this variable, per host? For example, would it be possible ...
raphink's user avatar
  • 12.2k
31 votes
1 answer
20k views

Make IIS see updated environment PATH variable

We've installed Oracle Express on a Windows 2003 Server and in the process it updated the PATH. We're trying to get IIS to see this change in the PATH but we can't figure it out. We've recycled the ...
Mark's user avatar
  • 2,091
29 votes
7 answers
177k views

How can I modify a user’s PATH environment variable without logging out?

The question pretty much says it all; I have users who do not have permission to edit their own PATH environment variable and if they need to have it modified for some reason, they need to log out so ...
ninesided's user avatar
  • 539
29 votes
1 answer
58k views

How to set environment variable for another user?

On Windows, how do I set an environment variable for a user other than the currently logged in one? I need to set the TMP variable to change the temporary directory used by an ASP.NET app.
George Mauer's user avatar
26 votes
6 answers
7k views

What are the advantages of putting secret values of a website as environment variables?

The devops guidelines at https://12factor.net/config suggest to put website secrets (database passwords, api keys, etc.) into environment variables. What advantages does that have instead of using ...
Aidas Bendoraitis's user avatar
21 votes
4 answers
34k views

Using environment variables in Kubernetes deployment spec

I currently use a Kubernetes spec Deployment.yaml for deploying a service. The spec includes a verbatim reference to a specific IP address (marked as <static-ip-address> below): spec: type: ...
Drux's user avatar
  • 676
20 votes
2 answers
11k views

Running shell script with no environmental variables

As I know, newly running shell script inherits it's environment variables. Is there a way to block this? (running shell without variable inheriting)
Eonil's user avatar
  • 10.6k
19 votes
8 answers
137k views

How to change default /tmp to /home/user/tmp

Is there an environment variable to set the temporary directory on debian based systems? I have a java applet that uses that environement variable and it's getting confused when launching two ...
Disco's user avatar
  • 1,431
19 votes
4 answers
22k views

Is there a utility to read environment variables from an env file and then run a command (more lightweight than foreman)?

foreman can read .env files and set environment variables from the contents, and then run a program e.g. foreman run -e vars.env myprogram ...but it does a lot of other things (and is primarily ...
wodow's user avatar
  • 590
18 votes
3 answers
128k views

How to set $LD_LIBRARY_PATH in Ubuntu?

I need to do this: On linux, we have to find a few dynamic libraries which are not on a standard location. We have to set $LD_LIBRARY_PATH to /path/to/sdk/lib How can I do that in Ubuntu 10....
Richard Knop's user avatar
  • 1,149
17 votes
4 answers
36k views

how to export VARs from a subshell to a parent shell?

I have a Korn shell script #!/bin/ksh # set the right ENV case $INPUT in abc) export BIN=${ABC_BIN} ;; def) export BIN=${DEF_BIN} ;; *) export BIN=${BASE_BIN} ;; esac # exit 0 <- ...
webwesen's user avatar
  • 945
17 votes
8 answers
47k views

SSH - set env vairables by every connection - godaddy shared host

My problem is, that I have to set env variables (like GIT_EXEC_PATH) on a server. I need that variables by every connection (so by bash and by remote commands either). I managed to set those variables ...
inf3rno's user avatar
  • 408
15 votes
1 answer
33k views

How to use variables in a systemd service file?

I'm creating a service file for a daemon, and I would like to use variables (in init scripts I used environment variables) to define some parameters for the executed scripts. For example, I would like ...
user886869's user avatar
14 votes
2 answers
15k views

Why is "AcceptEnv *" considered insecure?

In /etc/ssh/sshd_config, there is an option called AcceptEnv that allows the ssh client to send environment variables. I need to be able to send a large number of environment variables. These change ...
TheDauthi's user avatar
  • 143
13 votes
1 answer
28k views

Security risks of PermitUserEnvironment in ssh

I've read quite a few posts regarding the use of PermitUserEnvironment and the file ~/.ssh/environment in order to pass env variables to an ssh shell. The official sshd docs and a few other resources ...
Rob Squires's user avatar
13 votes
3 answers
29k views

Can I use nginx environment variables within static files that nginx serves?

If I use a environment variable in the nginx config, and nginx is configured to serve only static files (html,js,css - e.g. a AngularJs app), is there any way I can use the environment variable within ...
Tom's user avatar
  • 4,307
13 votes
4 answers
18k views

Environment Variables in PATH Not Expanded for non-Admin Command Prompt?

I have a Windows 7 machine which, when Command Prompt is run by a normal user, fails to expand environment variables in the %PATH%. If command prompt is instead run as administrator (right click, Run ...
Steve Vigneau's user avatar
12 votes
2 answers
18k views

What is the best way to set an environment variable in .bashrc?

When setting up a variable in .bashrc, should I use this? export VAR=value Or would this be enough? VAR=value What is exactly the difference (if there is one)?
Flávio Amieiro's user avatar
12 votes
3 answers
15k views

Can start-stop-daemon use environmental variables?

I need to daemonize a Windows app running in Wine, and create a pid in /var/run. Since it requires an X11 session to run, I need to make sure the $DISPLAY variable is set in the running user's ...
scottburton11's user avatar
12 votes
3 answers
909 views

Dynamically Authenticate Apache with LDAP Based on Request String?

It is possible to use a portion of the request URI as an input into mod_authnz_ldap's Require ldap-group directive? I'm trying to dynamically check access to a bunch of different project directories, ...
Chris 's user avatar
  • 405
11 votes
3 answers
31k views

PYTHONPATH environment variable...how do I make every subdirectory afterwards?

I currently do this: PYTHONPATH=/home/$USER:/home/$USER/respository:/home/$USER/repository/python-stuff How can I make it so that the PYTHONPATH can include everything subdirectory? PYTHONPATH = /...
Alex's user avatar
  • 8,521
11 votes
2 answers
23k views

Getting environment variables in PHP-FPM with Nginx

I've defined some environment variables like APP_ENV in my /etc/environment file, on my ArchLinux. If I type printenv, I see them. I've created this simple test file called… test.php <?php ...
chindit's user avatar
  • 205
11 votes
4 answers
7k views

Environment variable in /etc/environment with pound (hash) sign in the value

On Ubuntu 12.04, I have an environment variable defined in /etc/environment like this: FOO="value_before#value_after" When I ssh into the server to check the value, I get this: $ env | grep FOO FOO=...
Jaymon's user avatar
  • 273
11 votes
3 answers
43k views

How do I set the global PATH environment in a batch file?

The group policy in our environment overwrites the PATH variable every time I log on and, as I run a 'non-standard' computer, it gets it completely wrong (C:\Windows vs C:\WINNT, missing directories ...
TallGuy's user avatar
  • 213
10 votes
1 answer
36k views

How do you set server specific ENV values in Nginx?

I am starting a project that uses environment variables to set the database connection and a couple other things. (They didn't want to use configuration files since people are careless and overwrite ...
Xeoncross's user avatar
  • 4,489
10 votes
1 answer
67k views

%ProgramFiles% differences on 64bit Windows

From a command prompt, I get the following: >echo %ProgramFiles% C:\Program Files However, some applications (PHP in this instance, though I've seen the same behavior from within Apache's httpd....
ken's user avatar
  • 201
10 votes
1 answer
4k views

SSH: Behavior of SetEnv for TERM variable

I want to set the TERM environment variable to a different value for each of my remote machines, so i used SetEnv TERM=myTermForRemoteVar in ~/.ssh/config. The remote machine still sees TERM=...
Lazarus535's user avatar
9 votes
4 answers
17k views

Apache 2: SetEnvIf "IP Range"

In my Apache config I want to set an environment variable if I see that the visitor comes from an specific IP range. Currently I do it this way: SetEnvIfNoCase Remote_Addr "^194\.8\.7[45]\." banned=...
BlaM's user avatar
  • 3,926
9 votes
2 answers
15k views

Configure php-fpm to access environment variables in docker

I'm running php7-fpm in a docker container. However my php scripts aren't able to access environments variables set in my docker-compose file. getenv('MY_ENV_VAR') returns FALSE. I've changed /etc/...
Aidan Ewen's user avatar
9 votes
4 answers
26k views

"service"-command and environment variables

I am trying to start a service that requires a env. variable to be set to certain path. I set this variable in "/etc/profile.d/". However when I start this service using the service command, it doesn'...
Esa Varemo's user avatar
9 votes
3 answers
1k views

Excluding Environment Variables from ZSH Autocomplete

Quick example: ~ $ wor<TAB> ~ $ WORDCHARS= ...
Bryan Veloso's user avatar
9 votes
1 answer
12k views

Tomcat service does not see $JAVA_HOME

I'm trying to setup a Tomcat service with Systemd on CentOS 7. I've installed Oracle Java 1.8u74 to /usr/java/jdk1.8.0_74 and set the environment variable $JAVA_HOME at boot like so: # echo "export ...
isapir's user avatar
  • 233
9 votes
3 answers
7k views

Passing variables to use in the preseed file for a Debian Jessie installation

Is it possible to add a variable via the boot prompt to the Debian installer, so that variable can be used in a preseed file? In particular, I'm trying to solve the following problem: We have a ...
Tim Stoop's user avatar
  • 598
9 votes
1 answer
12k views

ssh configuration file environment variable?

I need to login into several remote ssh servers during my admin work. I work with three different computers client side, all of them are Debian GNU/Linux systems. I keep a workspace directory where I ...
Lucio Crusca's user avatar
8 votes
2 answers
22k views

Setting Server Variables before Apache Loads

We have CentOS with Apache running on it. Basically, I have a few variables in /etc/environment and they're passed through to our Apache configs using PassEnv. The issue is that because Apache is ...
Steve Griff's user avatar
8 votes
3 answers
22k views

Apache Custom Header with an environment variable

I try to set a custom HTTP Header with an environment variable** with Apache server 2.4.6 and headers_module. I work inside a HTTP VHost on port 80. Everything work as expected with basic example ...
S. Di Cioccio's user avatar
8 votes
1 answer
18k views

Setting %PATH% for a service?

I have a service which is installed that runs and executes certain commands periodically. It runs as the Local System account. The source code for the service is not under my control, but I do control ...
user avatar
8 votes
1 answer
162 views

Is there a way to control where a windows update extracts temporary files?

Working on a vendor built system, we've realized that OS partition (C:) they created was rather small (38 GB). The object is to update Windows 2008 R2 to SP1. Several sources state that 8 GB is ...
Chad Harrison's user avatar
7 votes
3 answers
7k views

authorized_keys Environment Variables Not Setting Environment Variables

I have created the file ~/.ssh/environment in there I put: LEVEL=0 When I run a script over ssh to get the environment variable level it returns 0 like it should. In the authorized_keys file I have ...
Buddy Lindsey's user avatar
7 votes
2 answers
4k views

Security implications of using relative paths in the PATH enivronmental variable?

We had an audit just flag us for having relative paths inside out $PATH env variable. I am uncertain if this is truly a security concern and would like to reach out to everyone to see if this is ...
ehime's user avatar
  • 597
7 votes
1 answer
4k views

Cron job running a Django Python command through a virtual environment not working

I have a crontab file supposedly executing a Django command after loading the project virtual environment: */1 * * * * source /home/virtualenvs/mydjangoproject-venv/bin/activate && python /...
bolino's user avatar
  • 275
7 votes
1 answer
7k views

Setting $PATH for weberver user

I tried to add $PATH for all users including the webserver user (i.e. www-data) with different methods such as editing /etc/profile, /etc/environment, etc. In all cases, it works in terminal, but not ...
Googlebot's user avatar
  • 1,067

1
2 3 4 5
9