I found a way to do it:

su - $user -c "env -i USER=${user} HOME=/../.. SHELL=/bin/bash PATH=/.../..
<program command>"

Michael Martinez
CSREES/ISTM/USDA
(202) 720-6223


-----Original Message-----
From: Steven W. Orr [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 26, 2002 12:34 PM
To: Martinez, Michael - CSREES/ISTM
Cc: '[EMAIL PROTECTED]'
Subject: RE: how to run a start up script as a non-privledged user?

On Thu, 26 Dec 2002, Martinez, Michael - CSREES/ISTM wrote:

=>Unfortunately "su -c cmd user" does not work for me. Some errors arise due
=>to the fact that the user's environment is not passed to the "cmd"
program.
=>My "cmd" program needs to inherit the user's login environment. 
=>
=>For the same reason, setting the program setuid does not work either. 
=>
=>As far as cron goes, how would you set cron to start the process after
each
=>system reboot? 
I have a the fetchmail service started for me at boot in rc.local

su -l sorr -c fetchmail                 # Start the fetchmail daemon

If I needed special environment stuff I would either add it to my 
.bash_profile or change the command a la

su -l sorr -c 'V1=val1 V2=val2 fetchmail'


-- 
-Time flies like the wind. Fruit flies like a banana. Stranger things have -
-happened but none stranger than this. Does your driver's license say Organ
-Donor?Black holes are where God divided by zero. Listen to me! We are all-
-individuals! What if this weren't a hypothetical question?
[EMAIL PROTECTED]



_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to