Change user

L

lucas

Is there a way to change the user from root to say 'nobody' after a perl
script is executed? Aside from using the English module that is.

Kind regards,
 
J

John W. Krahn

lucas said:
Is there a way to change the user from root to say 'nobody' after a perl
script is executed? Aside from using the English module that is.

$< = getpwnam 'nobody';


John
 
B

Brian McCauley

Is there a way to change the user from root to say 'nobody' after a perl
script is executed?

Define "the user" and "after".

I suspect you are asking if a process can alter the UID of its parent.
The answer is no.
Aside from using the English module that is.

I don't see how that fits in.
 
L

lucas

John W. Krahn wrote:

$< = getpwnam 'nobody';

Thanks john. I'm running Slackware10.1 and that didn't quit work for me. I
looked it up and there is the Real ID and the Effective ID. Here's the
quote:

"The $< and $> variables contain, respectively, the real user ID and
effective user ID for the program. The real user ID is the ID under which
the user of the program logged in. The effective user ID is the ID
associated with this particular program (which is not always the same as
the real user ID)."

So, I tried the Effective ID and it worked when I looked at the process from
another window. Here's the test code:

perl -e 'print "$> - $)\n";$>=getpwnam "nobody";$)=getgrnam
"nobody";sleep(5);print "$> - $)\n";'

Thanks for your help,
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top