[ale] Perl: checking UID in a perl script run from cron

Geoffrey esoteric at 3times25.net
Mon Aug 28 17:19:18 EDT 2006


Allan Neal wrote:
> I have a perl script I am running from cron.  The script must run as a certain
> user because of ssh key authentication.  I would like a function in the script
> that checks the UID of the script to verify that it is running as the correct
> user before proceeding.
> 
> I am using the "getlogin" function.  This works find from the command line,
> but when run from cron, it dumps out complaining that there is no login
> information to return.
> 
> How can I get around this?  Is there anyway to check the UID of the script
> process itself without using "getlogin?"

getpwuid maybe?

-- 
Until later, Geoffrey

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin



More information about the Ale mailing list