In order of simple to most complex here are some options:

1) Run the script as root and use the "su" command. THen you can just
call "su -c commandtorun" and it won't prompt you for a password.
2) Use sudo in a similar way. (Assuming you have sudo installed). You
can give your user account the permissions to do what you need, and
you will optionally only be prompted for your own password. e.g. You
can "wrap" an su string with sudo, so the script doesn't need to be
run as root.
3) In the Solaris world there is also the option of setting up a role
that has the permission to run the command you want. Not sure how to
go about setting this up, as I learned the other methods prior to Sun
developing roles. This combined with the fact the first two methods
are cross platform, means I never bothered to learn the ins and outs
of roles.

Cheers,
Brian

On Fri, May 8, 2009 at 9:01 AM, Christine Tran <[email protected]> wrote:
> Hi,
>
> I need to open a file and write, but not as my UID, as another UID.  I
> can finish writing and chmod the files, but I'd rather not do this.
> I'd rather open and write everything as this other UID, while running
> as myself.  Is this at all possible in the UNIX world or just bonkers?
>  Will it help if script runs as root?
>
> CT
>
> --
> http://www.apress.com/book/view/1430218916
> -------------------------------------------------------------------
> Pro OpenSolaris - 57 varieties. 31 flavors.
> _______________________________________________
> sysadmin-discuss mailing list
> [email protected]
> http://mail.opensolaris.org/mailman/listinfo/sysadmin-discuss
>



-- 
- Brian Gupta

New York City user groups calendar:
http://nyc.brandorr.com/
_______________________________________________
sysadmin-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/sysadmin-discuss

Reply via email to