If running on Unix, one can use the "su" command to
change to a different user. Then the perl script would have
to be run as root on the host.
To change user, the shell syntax is :
su - fred
So one could set up something like:
system("su - fred -c \"shell commands, mv a f, etc...\");
Inside the quotes, you can stack commands up like:
system("su - fred -c \"cmd 1; cmd 2; ... cmd n\");
Hope this helps.
.. Greg
-----Original Message-----
From: Steve Wright [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 31, 2001 7:06 AM
To: 'Beginners@Perl. Org'
Subject: change uid in perl ??
I'm quite new to perl & hoping someone here can help me.
I need my perl program to change to a different user and I'm not sure
how to
do it.
What I want;
run program a
run program b
change to user "fred"
move files
move more files
change back to root
run another program
I have perl running the programs but have not worked out the change to
user
fred bit yet...
Thanks
Steve.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]