-   Linux - Enterprise (
-   -   Hidden environment variables?? (

gdizzle 01-31-2013 06:59 PM

Hidden environment variables??
Hi all,
I am trying to port a custom application from a RHEL4 server to a RHEL6 server.

On the RHEL 4 server, if you run the command: "env". The person who set this up had custom environment variables set so the application could use them in the scripts.

I grabbed the environment variables. exported from the /etc/bashrc ran source and restarted the server and they now appear on the RHEL6 server.

Situation is the custom application I run, does not recognise these environment variables and I cannot locate them ANYWHERE on the RHEL4 box.

I have searched for hidden files, .bashrc, .bash_profile , /etc/bashrc, /etc/rc.local, files in /etc/skel for any export statements which define these variables on the RHEL4 system and cannot locate any.

My only thoughts are they are some how in the custom application code, and generated to the bash shell ?

anyone have any ideas? I am kinda stumped.

Thanks for your time...

vl23 01-31-2013 11:01 PM

Another place to check for custom variables is the application's startup script.
Also are you running this process as a daemon with its own application user, or manually?
Some more info would be good.

gdizzle 01-31-2013 11:22 PM

Sorry for the lack of info:

Ok it's a custom app they run called menu or bms.

lsof /applic/bms/obj/menu
menu 8798 npilavid txt REG 8,2 364444 1613601 /applic/bms/obj/menu
menu 12972 npilavid txt REG 8,2 364444 1613601 /applic/bms/obj/menu

ls -l /applic/bms/obj/menu
-rwxr-xr-x 1 phil bms 364444 Sep 29 17:13 /applic/bms/obj/menu : looks to run as user phil and everyone has to be in the group bms to run it.

file /applic/bms/obj/menu
/applic/bms/obj/menu: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), stripped

It loads up in there .bash_profile. There is no startup script or daemon for it.

# additional procedures for BMS users
if [ `id -gn` = "bms" ]
umask 0000
cd /applic/bms
case `id -un` in
return 0
exec menu

looks like the env variables must be set by this binary....


chrism01 02-01-2013 01:40 AM

The binary probably sets its own env for security. If it can't use them, it probably means the values are set in a cfg file somewhere. For super security, the cfg file could be encrypted with the key in the prog code.
Basically, save yourself some time and either ask the guy who wrote it or check the src.
You should have the src if it was written in-house.
If it wasn't written in-house, ask the company who supplied it.

Valery Reznic 02-02-2013 02:11 AM

If you run on your old server command

tr '\0' '\n' < /proc/<PID>/environ
you'll get all and any environment variables used by your program.
doesn't matter where them were set

gdizzle 02-03-2013 03:29 PM


pidof menu
24149 24117 23696 23664 23039 21803 21771

tr '\0' '\n' < /proc/21771/environ

: gave me the same environment variables as the bash shell.

It's ok I will contact the company who supplied it.

Thanks everyone for your help.

All times are GMT -5. The time now is 07:35 AM.