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

Rev. Johnny Healey rev.null at gmail.com
Mon Aug 28 17:52:28 EDT 2006


does "whoami" work?

if not, what about the $USER environmental variable (though, it is not
reliable from a security standpoint).

On 8/28/06, Allan Neal <allanneal at comcast.net> 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?"
>
> 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       |      |
> |      |                               |      |
> \     |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|     /
>   \   /                                 \   /
>    ~~~                                   ~~~
>
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...




More information about the Ale mailing list