From: Paul Lutus Date: 2006-12-12T12:15:07+09:00 Subject: Re: UID/EUID subshell solutions Luke Kanies wrote: > Hi, > > I'm having inconsistent behaviour with running external commands as > other users, and the time has apparently come to use something akin > to a fork and popen3 to get something approximating consistent > bahaviour. > > I'm currently setting EUID and executing external commands, but some > shells ignore that (which is apparently the "standard"). This is a very desirable shell behavior, to avoid an obvious hacker vulnerability. > > I need some solution that will allow me (when running as root) to run > shell commands as another user and capture stdout and (hopefully) > stderr. This basically means fork and run Process.uid = blah, but > there's some IPC to do too. > > Is there a semi-standard pattern for doing this, or does someone have > some simple example code I can use? `su (username) -c (command)` -- Paul Lutus http://www.arachnoid.com