[Galaxy S 4 General] hunktb:
Thanks to [MENTION=5154981]Mr.W0lf[/MENTION] for the script

I know this thread is about Galaxy S4, but I think general info about "chinese superuser app" (superuser installed with vRoot, RomasterSu, iRoot, Kingroot... all of them install same kinguser app) could be useful for anyone who wants to replace this app.

I tried to post in his forum some doubts How to Remove/Replace Chinese VRoot superuser with SuperSu, where I think there is an updated version 28-Jun-14 : upload new version to fix issue for non Samsung devices and delete more VRoot folders and files (not tested yet, waiting feedback ...). ... Replace_VRoot_With_SuperSU_V2.zip

but I finally managed to solve it and managed to replace kinguser with superuser (opensource, com.koushikdutta.superuser), so I have a clean system.

I share here some info, I hope it helps someone or maybe helps to make a generic script.

I found similar script in another XDA thread VRoot to SuperSU Installer

- First attempt: trying to install whatever new superuser app (superSU, superuser from Chainfire, superuser from Koush) over kinguser did not work: app installs ok, but it fails when trying to update su binary, and kinguser keeps controling superuser requests.

For example with superuser from Koush app message was "There was an error installing Superuser. Please send a log of the error to the developer"

- Second attempt: After googling I found this script, and I tried to change it for my phone (M-HORSE N9000W, android 4.2.2)

(First original, as comments with #, second replacement)

#/system/bin/rm /system/app/Superuser.apk
/system/bin/rm /system/app/Kinguser.apk

#/system/bin/rm /data/app/com.mgyun.shun.apk
#/system/bin/rm /data/app/com.mgyapp.android.apk
/system/bin/rm /data/app/com.kingroot.kinguser-1.apk

#/system/bin/rm -r /dev/com.mgyun.shua.su.daemon
#/system/bin/rm -r /dev/com.mgyun.shua.su
#/system/bin/rm -r /data/data/com.mgyunapp.android
/system/bin/rm -r /data/data/com.kingroot.kinguser/

#/system/bin/rm -r /data/data/com.mgyun.shua.su
#/system/bin/rm -r /sdcard/android/data/com.mgyun.shua.su
#/system/bin/rm -r /sdcard/mgyun
#/system/bin/rm -r /sdcard/mgyapp
#/system/bin/rm /data/dalvik-cache/data@app@com.mgyun.shua.su.apk.classes.dex
/system/bin/rm /data@app@com.kingroot.kinguser-1.apk@classes.dex

More things checked

root@android:/ #ls -l /system/etc/inst*
lrwxrwxrwx root root 2015-01-21 01:37 install-recovery.sh -> /system/bin/install-recovery.sh
-rw-r----- root root 85328 2014-12-23 16:30 install-recovery.sh-ku.bak
lrwxrwxrwx root root 2015-01-21 01:37 install_recovery.sh -> /system/bin/install-recovery.sh

root@android:/ #more /system/etc/install-recovery.sh
#!/system/bin/sh

/system/xbin/ku.sud -d &

/system/etc/install-recovery-ku.sh
/system/etc/install-recovery-kr.sh

Is the same content for /system/bin/install-recovery.sh

I also found /system/xbin/kugote, and I tested with strings these files are binaries related with kingroot

So I think I should add:

/system/bin/rm /system/xbin/ku.sud
/system/bin/rm /system/xbin/kugote
/system/bin/rm /system/etc/install-recovery-ku.sh*

I am not sure if it is mandatory to install busybox (some lines of the script do that), as I have it already installed

I tried that... but it did not work

Somehow kinguser allows to do anything as root ... except remove himself!

For example I was able to remove and write in /system after rw mount, but trying to remove or replace su binary fails ! so this script was not working.

And yes, I do have root access: I was tired to find post saying that if you can't delete a file in /system is beacuse you are not root or you have not rw mounted it ...

root@android:/ # id
uid=0(root) gid=0(root)
root@android:/ # uname -a
Linux localhost 3.4.5 #1 SMP PREEMPT Tue Sep 30 16:51:10 CST 2014 armv7l GNU/Linux

- Third attempt: I have an idea. I started a root adb shell, and being root, I unistalled kinguser (it has the option to return phone to "unrooted" state), ... I should have a root shell where I could be able to install a package through "pm" android utility ... no luck

- Fourth attempt and sucess: I have a new idea. As I realized I was able to replace kinguser with superuser in some phones, I thought that maybe some old kinguser app where easier to replace, so I tried to install old romastersu versions

I found that old versions did not work if wifi is disabled!? and with RomasterSu_1.1.4_140611_1000.apk I was able to use a simple Google Play com.koushikdutta.superuser was installed without error and replaced ok kinguser. New superuser requests were managed with new app.

I uninstalled kinguser with titatinum backup, and I made some cleanup

/data/data/com.kingroot.kinguser/
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 app_crash
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 app_tomb
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 applib
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 cache
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 databases
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 files
lrwxrwxrwx install install 2015-01-26 22:58 lib -> /data/app-lib/com.kingroot.kinguser-1
drwxrwx--x u0_a114 u0_a114 2015-01-26 23:02 shared_prefs