Late to the game on this, but it can be made permanent on stock. Root the phone of course, use a root file explorer with R/W permissions. Edit your build.prop text file found in the system folder. Scroll all the way to the end of the file and add the following line.
net.hostname=thenameyouwantyourdevicetobe
Where thenameyouwantyourdevicetobe is the name you want it to actually be ie; Galaxy S4 or Johns Phone etc etc...
Make sure to save the build.prop file before exiting or it will not save your text entry onto the build.prop file.
The name will now stick permanently even on reboots. Terminal Emulator works, but it changes when the device is rebooted.
Reboot
Profit
Enjoy