setuid() and getenv()?

V

vertigo

Hello
i need to read $PATH variable for all users.
I wanted to use something like setuid() and getenv() in C.
Are there similar functions here ?
(if not how can i do it ?)

Thanx
Michal
 
J

Joe Smith

vertigo said:
i need to read $PATH variable for all users.
I wanted to use something like setuid() and getenv() in C.
Are there similar functions here ?

See the docs on perlvar for the setuid() equivalent.

C: currentpath = getenv("PATH"); => Perl: $currentpath = $ENV{PATH};

For an idea on how to get a list of all users, their home directories,
and login shells:

perl -le 'while(@pw=getpwent){print join " : ",@pw[0,7,8]}'

Executing the user's login shell, as in
chdir $home; ($>,$)) = ($uid,$gid); $path=`$shell -c 'echo $PATH'`;
is an unacceptable security risk.

-Joe

P.S. Next time, post to comp.lang.perl.misc instead of comp.lang.perl.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top