Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Changing Root Password/Allowing Full System Access via RealBasic

Changing Root Password/Allowing Full System Access via RealBasic
Thread Tools
Posting Junkie
Join Date: May 2001
Location: Portland, OR
Status: Offline
Reply With Quote
May 14, 2001, 06:11 PM
 
I'm designing a program in RealBasic which needs to have full access to the "System" folder. It works nicely under Root, but unfortunetly, under any other user OS X keeps me from making changes to the System folder.

Another idea I had was to have my program automatically set up Root user access through the shell, and instructing the user on how to log into Root. I am using "Sudo passwd Root" for this. But, OS X requires the password to be entered on two seperate prompts, neither of which can be entered into using "sudo passwd root; thepass; thepass". The ";" dosn't fill in prompts but will issue "thepass" as a command after I fill in the prompts in the command line.

Someone please help! No one has been able to answer my question! I would really like to be able to access the System folder in a normal user account. I also don't want to have to issue all commands having to deal with moving and editing files through the shell. I would instead like to have full access to the "System" folder using RealBasic's native commands.
8 Core 2.8 ghz Mac Pro/GF8800/2 23" Cinema Displays, 3.06 ghz Macbook Pro
Once you wanted revolution, now you're the institution, how's it feel to be the man?
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 17, 2001, 02:58 PM
 
I don't think that you can with REALbasic's current shell class. This would be easy if you used Objective-C and Cocoa, since the Authentication framework allows an app to gain root privs. Perhaps it would be possible in some convoluted way using a plugin, but they have to be written in C++, so it would probably need lots of messy bridging.

Why do you need to modify /System, anyway? It's bad karma to do so, and Apple's official word is "don't do it".

I strongly suggest learning Obj-C/Cocoa, it's not that complicated and you'll benefit a lot from it.
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
May 18, 2001, 08:24 AM
 
[Oops; there was a misunderstanding here. Disregard this post entirely.]

[This message has been edited by Millennium (edited 05-18-2001).]
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Grizzled Veteran
Join Date: Dec 2000
Location: Málaga, Spain, Europe, Earth, Solar System
Status: Offline
Reply With Quote
May 22, 2001, 11:42 AM
 
I just found a way to execute shell commands as root with REALbasic, the final command string I send to the shell class is something like this:

"echo password | sudo -S command"

Where password is the root password and command is the chosen command to execute. The trick here is to use the "S" option of sudo, which redirects the keyboard input to standard input, in this case the result of the echo command.
     
Fresh-Faced Recruit
Join Date: May 2001
Location: Austin, TX, USA
Status: Offline
Reply With Quote
May 22, 2001, 06:44 PM
 
this is exactly what you need to do. There are a few things that you cannot do, such as "top".
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 23, 2001, 03:08 PM
 
And would be much better/easier to do in Cocoa! Using the Authentication framework to gain super-user privs for an NSTask seems like a much better way of doing things.
     
Grizzled Veteran
Join Date: Dec 2000
Location: Málaga, Spain, Europe, Earth, Solar System
Status: Offline
Reply With Quote
May 23, 2001, 03:22 PM
 
Well Angus, we already know that with Cocoa it is easy.... buuuut we want to know how to do it with REALbasic. Is that so hard to understand?
     
Professional Poster
Join Date: Sep 1999
Location: Ottawa, ON, Canada
Status: Offline
Reply With Quote
May 23, 2001, 04:16 PM
 
Originally posted by eevyl:
Well Angus, we already know that with Cocoa it is easy.... buuuut we want to know how to do it with REALbasic. Is that so hard to understand?
Is there a way (theoretical or actual) to use Cocoa objects from RealBasic or C++? I guess that's the million dollar question.
     
goMac  (op)
Posting Junkie
Join Date: May 2001
Location: Portland, OR
Status: Offline
Reply With Quote
May 23, 2001, 05:10 PM
 
Originally posted by Lorin Rivers:
this is exactly what you need to do. There are a few things that you cannot do, such as "top".
Wow.... Someone from REAL software came all this way to answer my question..... I am humbled...
8 Core 2.8 ghz Mac Pro/GF8800/2 23" Cinema Displays, 3.06 ghz Macbook Pro
Once you wanted revolution, now you're the institution, how's it feel to be the man?
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
May 24, 2001, 01:14 PM
 
Originally posted by hayesk:
Is there a way (theoretical or actual) to use Cocoa objects from RealBasic or C++? I guess that's the million dollar question.
Short answer: No and no.
Long answer: Maybe.

C++ needs to have bridging functions, as you can see from Apple's sample code page. Apple is working on reimplementing Obj-C++, so that should do away with that problem.

REALbasic might be able to use them in theory, but you'd need to do some haquery. Someone made a custom plugin linker thing for CodeWarrior to enable you to call functions inside Mach-O libraries from CFM applications. This might enable you to load Foundation or something, but then I'm not sure how you'd go about implementing Obj-C code (I know CW has an Obj-C compiler but their runtime is probably different than Apple's). You could conceivably write your own framework with C functions which use Obj-C classes, and then link against that with a REALbasic plugin. I'm not sure if it would work though, and would become an evil mess. Might be an interesting thing for someone to try, though.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:34 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2