How do you pass authentication on the command line?

Sarah Reichelt sarahr at genesearch.com.au
Fri Feb 6 02:18:22 EST 2004


Hi Ken,

Here's what I did when I wanted to be able to run the "date" command 
with sudo:

   set the shellCommand to "/bin/sh"
   put "#!/bin/sh" & cr into tScript
   put "pw=" & myPassword & cr after tScript
   put "echo $pw | sudo -S date " & tDate & tTime & cr after tScript
   put shell(tScript) into tCheck

myPassword is a variable containing the current user's password. It 
would be a good idea to store this encrypted somewhere. You will need 
to replace everythig after the "sudo" on the fourth line, with whatever 
shell script you want to execute.

Cheers,
Sarah
sarahr at genesearch.com.au
http://www.troz.net/Rev/

On 6 Feb 2004, at 5:04 pm, Ken Ray wrote:

> I have a situation where I've got Panther running on my G4 and it has
> Web Services turned on. A Rev CGI is running that reaches out of the 
> web
> server directory to another directory on disk to write a text file in a
> specific folder. However once it does this, the owner of the file is
> "www" (with read/write permissions) and the group is "wheel" (read only
> permission) and the "Other" also only has read-only permission. What I
> then need to do is have another standalone Rev app on the same machine
> open, edit, and save back to that same file. The problem is that I 
> can't
> do that with the current permissions, and the only way I know to make 
> it
> happen is to do a "sudo chown" through the terminal... but it asks for
> password authentication. I need to be able to do it straight from Rev.
>
> So how do you "sudo" via shell() in Rev and pass authentication on the
> command line?
>
> Any help is greatly appreciated...
>
> Ken Ray
> Sons of Thunder Software
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/



More information about the use-livecode mailing list