Welcome to the most active Linux Forum on the web.
Go Back > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.


  Search this Thread
Old 01-31-2013, 06:59 PM   #1
Registered: Jul 2012
Posts: 234

Rep: Reputation: Disabled
Red face 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...
Old 01-31-2013, 11:01 PM   #2
Registered: Mar 2009
Posts: 125

Rep: Reputation: 8
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.
Old 01-31-2013, 11:22 PM   #3
Registered: Jul 2012
Posts: 234

Original Poster
Rep: Reputation: Disabled
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....

Old 02-01-2013, 01:40 AM   #4
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,847

Rep: Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584Reputation: 2584
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.
Old 02-02-2013, 02:11 AM   #5
Valery Reznic
ELF Statifier author
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
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
Old 02-03-2013, 03:29 PM   #6
Registered: Jul 2012
Posts: 234

Original Poster
Rep: Reputation: Disabled
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Environment variables xeon123 Linux - General 6 05-18-2007 07:57 PM
Environment Variables - where do they go!?! iansoundz Linux - General 7 11-17-2005 02:27 AM
environment variables kakridge Linux - Newbie 1 07-14-2003 06:25 PM
Problems with php 4.2.1 form-data and hidden variables coea77 Programming 1 10-10-2002 03:24 AM
environment variables da Perp Linux - Newbie 5 01-23-2002 09:34 AM > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 11:12 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration