The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > iPhone Modding > General iPhone Chat
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 07-01-2008, 11:23 AM
What's Jailbreak?
 
Join Date: Jul 2008
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts
How to become root inside a native application

Hi all,
does anyone know how to become root inside a native application?
By default, native applications are executed by the mobile user. In my application, I need to execute some system commands (with the "system('command');" call) which need root privileges.
Since "sudo" does not exist, and since "su" does not work, the only way I found to become root is by typing "ssh root@localhost". The problem is that in this way, we need to introduce the root password in an interactive way and so, not possible inside the source code of my application, i.e. system(ssh root@localhost 'command'); will not work since we can not introduce the root password.

Then I tried several solutions:
1. Configuring the ssh server with public/private keys in order to be able to log as root without password. This solution does not work with the ssh server of the bsd subsystem!

2. Setting the UID and GID of the mobile user to 0 (like root user) in the passwd and master.passwd files of the iphone file system. The bsd subsystem crashes!

3. Creating a shell script (with the password inside the script in clear text) to do the ssh login automtically, and then executing it from my application with the system command instead of executing the ssh login directly from my application. The problem is that the only way I know to do this script is using the "expect" interpreter not available in the bsd subsystem!

4. chmod ugo+s 'command'. It does not work!

Please, does anybody know a solution to my problem?
Thank you very much!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2  
Old 07-01-2008, 02:37 PM
iPhone? More like MyPhone
 
Join Date: Nov 2007
Device + Firmware: iPhone 3G 2.0
Operating System: Intel Mac OSX Leopard
Posts: 201
Thanks: 8
Thanked 32 Times in 29 Posts

use cydia to download sudo. then using sudo will give let u be the root user for certain commands.

i.e.:
ls (executed as mobile)
sudo ls (executed as root)
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
The Following User Says Thank You to mbrooksr For This Useful Post:
dememali (07-02-2008)
  #3  
Old 07-02-2008, 04:42 AM
What's Jailbreak?
 
Join Date: Jul 2008
Posts: 2
Thanks: 1
Thanked 0 Times in 0 Posts

Thanks!!
But before installing cydia (the iphone is not mine)...do you know if for example "sudo route add -host 10.0.0.2/8 10.0.0.1" will work?
Coud you try it for me in case you have cydia installed?

Thanks again!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4  
Old 07-02-2008, 11:39 AM
iPhone? More like MyPhone
 
Join Date: Nov 2007
Device + Firmware: iPhone 3G 2.0
Operating System: Intel Mac OSX Leopard
Posts: 201
Thanks: 8
Thanked 32 Times in 29 Posts

Quote:
Originally Posted by dememali View Post
Thanks!!
But before installing cydia (the iphone is not mine)...do you know if for example "sudo route add -host 10.0.0.2/8 10.0.0.1" will work?
Coud you try it for me in case you have cydia installed?

Thanks again!
no problem. i tried it and it works fine.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > iPhone Modding > General iPhone Chat

Thread Tools
Display Modes

Posting 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



Go to Top
ModMyI

All times are GMT -6. The time now is 09:17 PM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 Copyright © 2007-09 by ModMy, LLC. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / RSS / Contact Us / / Privacy Statement / Top