sudo on OSX

Pierre Sahores psahores at easynet.fr
Sun Oct 6 08:48:01 EDT 2002


Simon Lord a écrit :
> 
> Hi all, I have a minor problem with the StartupItems under OSX.  It's
> owned by root.  So the application I'm writing can't set a script there
> to launch on startup.  This is likely a security measure so my option
> is to send a command to sudo and write/copy the script to the
> StartupItems directory.  Problem is how does one do that?  I'll need to
> ask the user to enter the password (root only, users cannot modify) but
> then how do I actually run it in a command line *with* the password?
> IE,. I don't want to run the script and have the Terminal say "ok,
> what's the password", I want to include the password in the command to
> copy the script to the StartupItems folder.
> 
> Any ideas?
> 
> Sincerely,
> Simon
> 
> _______________________________________________
> metacard mailing list
> metacard at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/metacard


Hi Simon,

The script below is what i use from within metacard to send a sql
request (in fact, the "test.sql" stored procedure) to oracle 9i as the
oracle home owner and the scott (user)/ tiger (password). This works
with posix shells (linux for me) and is far sure ok under MacOS X 1.5
and above. What you need is to adapt the first part of this shell script
example - from within metacard or not - to your own needs ("su - user
-c"...). Don't forget that it's always better to avoid the use of the
"root" user in standards productions contexts, each time it's possible.

on mouseup
global LepathRacine
    put "select * from docsrefs" & return & "/" & return & "exit" into
url (LepathRacine & "test.sql") ## the sqlplus stored procedure
    answer line 13 to -1 of shell ("su - oracle -c" && quote & "sqlplus
scott/tiger at sirst.wmax.org @" & LepathRacine & "test" & quote & return &
"oracle") ## the sql request
end mouseup

-- 
Best Regards, Pierre Sahores

WEB & VPN applications & databases servers
Inspection académique de Seine-Saint-Denis
Qualifier & produire l'avantage compétitif



More information about the metacard mailing list