1. Are you ready for the Galaxy S20? Here is everything we know so far!

Do Android phones have su folder by default? Implement root detection using Rootbeer

Discussion in 'Android Apps & Games' started by Calvert Wong, Aug 16, 2019.

  1. Calvert Wong

    Calvert Wong Newbie
    Thread Starter

    There are a few questions related to each other and I couldn't type it out in the title.

    Do Android phones and emulators have su folder by default? From what I have seen, Android Studio emulator has the su folder but not my Xiaomi actual phone. I am asking this is because I am trying to implement the root detection feature to an app and I have downloaded the Root Check Basic app to play around with.

    I am trying out the Rootbeer library and it says my emulator is rooted because there is a su folder in it but Root Check Basic says it is not rooted. Are there any manufacturer out there included su folder in Android phones?
     

    Advertisement

  2. Dannydet

    Dannydet Extreme Android User

    No.
    Just because there's a su folder doesn't mean it's rooted.
    Install a root checker from the play store to verify
     
    GameTheory, Calvert Wong and ocnbrze like this.
  3. ocnbrze

    ocnbrze DON'T PANIC!!!!!!!!!

    android studio is different then your phone. so yes since android studio is for app development of course you will have an su folder. your phone, unless it is rooted will not have an su folder( even if it is rooted will nopt actually have an su folder). a rooted phone will have access to root, but it will not have a specific folder called su.
     
    GameTheory, Calvert Wong and Dannydet like this.
  4. Calvert Wong

    Calvert Wong Newbie
    Thread Starter

    Just to clarify you mean detecting for the existence of the su folder won't 100% tell the phone is rooted? I am trying find better ways to determine if a phone is rooted and there are so many things that can check and prevent it from being detected.
     
  5. ocnbrze

    ocnbrze DON'T PANIC!!!!!!!!!

    correct. at least with my phones that i have rooted never had an su folder. so just by searching for that does not necessarily mean it is rooted.

    there are ways to determine if the phone is rooted. you can download the superuser app, it will tell you if you have root permission or not. you can download a terminal emulator on your phone and type "su"........this might be something you might be interested.

    also some apps that members here posted:
    https://androidforums.com/threads/rootsu-root-checker.1290087/
     
    GameTheory likes this.
  6. GameTheory

    GameTheory Android Expert

    It seems the Rootbear library is giving a false positive due to its' aggressive root check. On the other hand, Root Check Basic is probably just searching for the su binary file which wouldn't be present on a non rooted device.

    The su binary location can vary depending on root method. For magisk which is the most common root method, you can find the binary in the "/sbin" directory which is just a symlink to the magisk binary.

    One way to search for root with java is as follows...

    Code (Java):
    1. private static boolean checkSU() {
    2.   String[] paths = {
    3.     "/su/bin/su",
    4.     "/system/xbin/su",
    5.     "/su/xbin/su",
    6.     "/sbin/su",
    7.     "/system/bin/su",
    8.     "/data/local/xbin/su",
    9.     "/data/local/bin/su",
    10.     "/system/sd/xbin/su",
    11.     "/system/bin/failsafe/su",
    12.     "/data/local/su"
    13.   };
    14.   for (String path : paths) {
    15.     if (new File(path).exists()) return true;
    16.   }
    17.   return false;
    18. }
    I do recommend combining this with other methods.
     
  7. There is an app on play store to check phone rooted or not. first check that and confirm that is actual root conformation folder or not.
     
Loading...
Similar Threads - Android phones folder
  1. Roger Cordrey
    Replies:
    4
    Views:
    71
  2. svim
    Replies:
    0
    Views:
    170
  3. Jeffrey Walker
    Replies:
    2
    Views:
    208
  4. BrettLG
    Replies:
    5
    Views:
    430
  5. dontpanicbobby
    Replies:
    7
    Views:
    356
  6. Rob
    Replies:
    12
    Views:
    403
  7. Android News
    Replies:
    0
    Views:
    255
  8. Android News
    Replies:
    0
    Views:
    193
  9. Android News
    Replies:
    0
    Views:
    188
  10. Android News
    Replies:
    0
    Views:
    132

Share This Page

Loading...