Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!ucsd!pacbell.com!pacbell!att!mcdchg!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.wizards Subject: Re: Cron jobs running as something other than root Keywords: Cron Message-ID: <1990Aug30.145743.2949@chinet.chi.il.us> Date: 30 Aug 90 14:57:43 GMT References: <26d9499b.2715@petunia.CalPoly.EDU> <1990Aug29.110345.19301@cbnews.att.com> Distribution: na Organization: Chinet - Chicago Public Access UNIX Lines: 18 In article <1990Aug29.110345.19301@cbnews.att.com> mvadh@cbnews.att.com (andrew.d.hay) writes: >In article <26d9499b.2715@petunia.CalPoly.EDU> gmartin@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@chinet.chi.il.us