0

So, I have a device in which I need to unmount a dir. I wanted to run something like:

Runtime.getRuntime().exec("system/bin/busybox/ umount /mydir/subdir");

The issue is that I need root to unmount. Can I gain root through busybox in a one line command with the umount command?

EDIT: Sorry, The device is already rooted. I can go shell through ADB: adb shell...umount /mydir/subdir

This is two commands to achieve. I need to be able to do this through one line, and was thinking that using busybox is the way to achieve it. I'm thinking something like:

Runtime.getRuntime().exec("system/bin/busybox/"gain shell as above here" umount /mydir/subdir");

Am I way off base here?

Soner Gönül
  • 91,172
  • 101
  • 184
  • 324
Mick0311
  • 131
  • 3
  • 11
  • 1
    No, busybox is not the tool to do this. Most "rooted" devices use some sort of hacked su binary. The question of how to use that has numerous duplicates here and is not something that needs to be asked or answered again. – Chris Stratton Dec 17 '12 at 20:33

2 Answers2

2

No, you can't.

Rooting a locked device is not something that can be achieved by a simple Unix command. You need to find an exploit on your device's firmware to be able to obtain root privileges.

You can certainly find a way to root your device if you try to google it, but the procedure varies by device and by firmware version. When you find it, it would probably be a script and/or executable that takes advantage of an specific exploit on your device, and not just a generic command.

Juan Gomez
  • 1,488
  • 1
  • 11
  • 21
0

There are different ways to do this, but typically you need to get root access first with su and then execute your command. su -c umount /mydir/subdir should do it in your case.

If all this sounds confusing, you might want to try a library that makes it easier, such as roottools: http://code.google.com/p/roottools/

Nikolay Elenkov
  • 51,084
  • 9
  • 81
  • 82