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

Allan Neal allanneal at comcast.net
Mon Aug 28 17:03:09 EDT 2006


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?"

Allan
-- 
 / ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \
|  /~~\                                 /~~\  |
|\ \   |   I would rather be exposed   |   / /|
| \   /|     to the inconveniences     |\   / |
|  ~~  |  attending too much liberty   |  ~~  |
|      |  than to those attending too  |      |
|      |     small a degree of it.     |      |
|      |      - Thomas Jefferson       |      |
|      |                               |      |
 \     |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|     /
  \   /                                 \   /
   ~~~                                   ~~~
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available




More information about the Ale mailing list