Cron jobs running as something other than root

Leslie Mikesell les at chinet.chi.il.us
Fri Aug 31 00:57:43 AEST 1990


In article <1990Aug29.110345.19301 at cbnews.att.com> mvadh at cbnews.att.com (andrew.d.hay) writes:
>In article <26d9499b.2715 at petunia.CalPoly.EDU> gmartin at polyslo.CalPoly.EDU (Hackman) writes:
>[]
>"	Is there any way to make a job that runs from cron run under a 
>"        different login id???
>
>* * * * * su UID -c "command -args"

A potential problem with this is that if the user name mentioned happens
to have ksh as his login shell, his .profile will be executed. A workaround
is to use /bin/sh as the login shell but exec /bin/ksh in the user's
 .profile after exporting any necessary variables.  This is even more of
a problem if the "su -c user" appears in the /etc/rc files because these
commands run connected to the console causing any interactive prompts
to hang waiting for input.

Les Mikesell
  les at chinet.chi.il.us



More information about the Comp.unix.wizards mailing list