On Thu, 2003-02-20 at 23:15, Richard Esplin wrote: > I'm just an aspiring PFY, but I would suggest setting the setuid bit on > another script which performs the actions that you want, and then calling > that script from the script which runs as root. This gives you the added > benefit of logging out of that user whent he script is done. > Things like logging out (and I would assume su, though I haven't tried it) > are very difficult in bash, but easy in csh (anybody know how to do it in > korn?). Power vs. ease of use. Now that I'm more comfortable with Unix, I'm > really tempted to switch to csh. > Just throwing out ideas.
Just so you know, you can't setuid root a script. In otherwords you can't setuid root any executable file that has "#!" at the beginning of it. If you need setuid root functionality in a script, you'll have to write a wrapper c function. Anyway, that's not really what he was asking for anyway. If you don't mind perl David, perl can change uid and gid using setuid() and setgid(). Other than than, su might be your best bet. Michael > > On Thursday 20 February 2003 22:23, David Smith wrote: > > I'd like to be Borne Again in a script running as root. How can I change > > to a different user (su won't work) during execution, like setuid(int) > > does in C? > > > > --Dave > <snip> > > ____________________ > BYU Unix Users Group > http://uug.byu.edu/ > ___________________________________________________________________ > List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list -- Michael Torrie <[EMAIL PROTECTED]> ____________________ BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________ List Info: http://phantom.byu.edu/cgi-bin/mailman/listinfo/uug-list
