Operating System - Linux
1748053 Members
4613 Online
108758 Solutions
New Discussion юеВ

Re: how do i get the environment variables of a proces?

 
Ralph Grothe
Honored Contributor

Re: how do i get the environment variables of a proces?

Maybe not quite what you miss,
but how about parsing the listener process from the proc table.
Most of the times it should enclose the ORACLE_HOME up to bin in its (ps) args.

e.g.

# UNIX95= ps -u oracle -x -o args|grep tns
/app/oracle/product/9.2.0/bin/tnslsnr l_alma -inherit

@Hein "how can one create a truly secure environment?"

The Linux folks have come up with an abundance of possible solutions.
To name but a few

SELinux, AppArmor, VServer, Xen, User Mode Linux

or from BSD take jails etc., etc.

The /proc filesystem is a true boon that on Linux'es that don't use any of the above separations or mandatory access controls
that I sometimes miss on HP-UX.

Madness, thy name is system administration
Naoum
New Member

Re: how do i get the environment variables of a proces?

Ralph, that's exactly what i meant. thanks.
Matti_Kurkela
Honored Contributor

Re: how do i get the environment variables of a proces?

Hein, Ralph, Court:

In Linux, much detailed information is available at /proc// virtual directories... but the security-sensitive information is protected so that you must be the owner of the process (or root, of course) to be able to read it. This protection is achieved through traditional unix filesystem permissions.

In particular, the environment file /proc//environ is protected:
$ ls -l /proc/1/environ
-r-------- 1 root root 0 2007-04-11 17:52 /proc/1/environ
$ ls -l /proc/11882/environ
-r-------- 1 mkurkela mkurkela 0 2007-04-11 17:56 /proc/11882/environ
$ cat /proc/1/environ
cat: /proc/1/environ: Permission denied

(Process 11882 in the example above is my current shell. Process 1 is init, of course.)

As /proc is a virtual filesystem, these file permissions are automatically generated whenever someone tries to read the files/directories under /proc. So the permissions can't really be changed to cause security breaches.

So now we know that the original perl script on Linux was either run as the same user than the interesting process, or run as root.

MK
MK
Gary Cantwell
Honored Contributor

Re: how do i get the environment variables of a proces?

Hi,

Please take a moment to assign points to those who have taken the time to assist you. Here's how:

http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Thanks,

Gary
Naoum
New Member

Re: how do i get the environment variables of a proces?

done.