How to Change Wifi Host Name of Your Android Device

Most of the ROMs (except CM) whether it be stock or any, don’t have a setting to change the host name of your Android device. Read on to know how to change it.

When you have a common wifi network between your desktop and mobile, it rather makes sense to have a proper host name for your phone instead of accessing it every time by the IP address. This is typically useful if you want to control your phone from your control using AirDroid for example. Chat using Texts. While most routers have an option to set host name for a specific MAC ID, but on some networks you might not have control, for example your office network.

The process is very simple, but you need a rooted device. If you have not rooted it yet, check XDA forums. I can’t help you in that. Also, you would need the Android SDK (mainly adb and the device drivers for your phone).

    • Turn on USB Debugging in developer options.

    android_usb_debugging

      • Connect it to your computer
      • Open terminal
      • Run adb pull /system/build.prop
      • Now edit build.prop (saved in the directory you executed the command) and add the following line:

        • Run adb push build.prop /sdcard (or /mnt/sdcard, if it fails).
        • Run adb shell and type the following commands:

        • Run adb reboot.
        • Enjoy
        • Michael Mol

          Excellent.

        • Devian50

          This fucked up my phone. It wouldn’t be able to get past the company branding of my carrier. >.> Thanks a lot. replacing the original build.prop won’t fix shit either.

          • http://nileshgr.com/ Nilesh Govindrajan

            Ouch. The simplest solution for you now would be to get your phone’s ftf from xda and flash it. You would need titanium backup for backup and restore your data.

            But the funniest part is how it didn’t work for you. I did this on two phones of mine and it worked for me.

            If you have CWMR (or any other recovery), try wiping dalvik cache and reboot. It should solve the problem.

          • Isaac Parker

            Perhaps this had to do with the end line character? I’m just brainstorming here but if this is done on a Windows machine perhaps this^ build.prop had incompatible characters?
            EDIT: Looks like someone mentioned this further down in the comments

            • http://nileshgr.com/ Nilesh Govindrajan

              Possibly. Windows adds rn at the end of lines, while Linux uses just n. And most of the times, they’re not compatible with each other.

          • Joe Kemp

            I had the same problem as you. The issue turned out to be caused by the permissions on the file I pushed. it should be -rw-r–r– not -rw-rw-r–

        • Jeffrey Thompson

          Hey, thanks for the tips. I recently found a more detailed tutorial for this a while back:http://blog.burrowsapps.com/2011/09/android-change-hostname.html.

          Shows you how to use SQLite3.

          • http://nileshgr.com/ Nilesh Govindrajan

            I’d definitely come across that when I searched around, but it seemed too complex.

            The build.prop trick works great on most roms.

        • Eleazar

          also messed up my phone… T989 with ICS… won’t boot. What has this been tested on?

          • http://nileshgr.com/ Nilesh Govindrajan

            It works on both my Sony devices: Xperia S and Xperia Mini Pro. Both the stock ROMs.

            • Eleazar

              hmm, i edited it with wordpad, and i think it changed the line breaks… maybe thats it?

            • http://nileshgr.com/ Nilesh Govindrajan

              Quite likely.

        • Browner87

          Thank you for this. I knew it had to be in a config somewhere. My Nexus 4 was already rooted so i just downloaded a terminal app, granted it sudo rights with SuperSu, mounted as writable, made a backup copy of the file, added that line to the end (without the angle brackets) in vi, then saved and re-mounted and rebooted my phone and it worked perfect. Thanks a ton for the writeup! Although i might not suggest this to newbies to programming. If your phone “won’t boot” then you must likely made a simple mistake. But if you didn’t backup the file and you don’t know how to restore it from a terminal in fast-boot mode, then you could be toast.

        • Guest

          Alternatively, you can use this once you’ve edited the build.prop file
          adb root (this restarts adbd as root)
          adb remount (this makes reading/writing from the /system area possible)
          adb push build.prop /system/build.prop

        • setpropers

          Adb shell
          $ su
          # setprop net.hostname DESIRED.HOST.NAME

        • danielmilloy

          Excellent. I used the Build Prop Editor app from JRummy (https://play.google.com/store/apps/details?id=com.jrummy.apps.build.prop.editor) and I added the property painlessly to my build.prop on AHRD ROM. Rebooted, and voila!

        • Shankar Valleru

          Install the BuildProp Editor app and add the net.hostname key-value pair, It’s way easier and fast !

          • http://nileshgr.com/ Nilesh Govindrajan

            Yeah, that is one way and better too. I did not know about the editor when I wrote this

        • Andrew

          You need to edit th adb push command to /mnt/sdcard/

          You left off the last slash.

          • http://nileshgr.com/ Nilesh Govindrajan

            Differs from phone to phone. Some phones mount sdcard at /mnt/sdcard and create a link to it at /sdcard. While some mount directly at /sdcard.