New topic: OSX Terminal password question
<http://forums.realsoftware.com/viewtopic.php?t=26355> Page 1 of 1 [ 4 posts ] Previous topic | Next topic Author Message atarikid Post subject: OSX Terminal password questionPosted: Sat Feb 07, 2009 10:23 am Joined: Wed Feb 04, 2009 1:43 pm Posts: 3 I have made a little app (OSX only) which launch some commands in the terminal (shell) for deleting a file. I use this simple line of code in RB: terminal.execute "sudo rm /Library/Preferences/setup.txt" But this doesn't work because it needs a password (admin rights). How can I get the rights from a RB application? TIA Top ChickenScratch Post subject: Re: OSX Terminal password questionPosted: Sat Feb 07, 2009 10:31 am Joined: Fri Feb 15, 2008 5:14 pm Posts: 24 echo "password" | sudo -S <command> Top npalardy Post subject: Re: OSX Terminal password questionPosted: Sat Feb 07, 2009 11:00 am Joined: Sat Dec 24, 2005 8:18 pm Posts: 4395 Location: Canada, Alberta, Near Red Deer careful with that as a long running command will reveal the password when using ps in terminal something like this (courtesy of Tim Jones on the NUG) which executes a very short quick command that starts an authenticated session is less likely to reveal the password Code: // execute a really quick command mShell.Execute "echo " + myPassword + " | sudo -S /usr/bin/true" // that command will most probably NOT show up in a ps ax command call mShell.Execute "sudo the_real_command" // password is not required for this call // handle the mShell.ErrorCode and Result mShell.Execute "sudo -K" // That last one resets the sudo "no password" allowance _________________ My web site Great White Software RBLibrary.com REALbasic learning Top atarikid Post subject: Re: OSX Terminal password questionPosted: Sat Feb 07, 2009 11:26 am Joined: Wed Feb 04, 2009 1:43 pm Posts: 3 Thx .. this was very helpful! It works perfect. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 4 posts ] -- Over 900 classes with 18000 functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v8.1. <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml> [email protected]
