running as another user?

Paul Fox pgf at brightstareng.com
Thu Jan 19 20:48:10 UTC 2006


 > > was running as root, and su doesn't have the -c command like it does
 > > on RedHat (I don't know if thats standard or not, I don't have -c on
 > > my Gentoo machine either).
 > 
 > On ubuntu, -c passes a command to the shell via -c.  (Seems kinda pointless.)

i'm not sure exactly which part is pointless.

the -c option for su and sh is certainly traditional.  it lets
you pass a full shell command, including full syntax: 
redirections, semi-colons, etc, to the shell:
    su -c pgf "date | mail -s foo someone; echo mail sent >/tmp/junk"
very useful in places like crontab.

maybe i'm missing something, and this is possible without -c, but
i don't think so.  well, i guess if it's available for sh, you
don't need it for su:
    su pgf sh -c "date | mail -s foo someone; echo mail sent >/tmp/junk"

paul
=---------------------
 paul fox, pgf at brightstareng.com



More information about the busybox mailing list