Changing the default shell on iPhone

I wanted to change the default shell on my iPhone. Unfortunately chsh wasn’t available.

[10:40][root@iPhone:~]$ chsh
-bash: chsh: command not found

I next thought to modify /etc/passwd but, according to the file’s header, that’s not going to help.

[10:41][root@iPhone:~]$ cat /etc/passwd 
# 4.3BSD-compatable User Database
# Note that this file is not consulted for login.
# It only exisits for compatability with 4.3BSD utilities.
# This file is automatically re-written by various system utilities.
# Do not edit this file.  Changes will be lost.
nobody:*:-2:-2:Unprivileged User:/var/empty:/usr/bin/false
root:*:0:0:System Administrator:/var/root:/bin/sh
mobile:*:501:501:Mobile User:/var/mobile:/bin/sh
daemon:*:1:1:System Services:/var/root:/usr/bin/false
_sshd:*:75:75:sshd Privilege separation:/var/empty:/usr/bin/false
_unknown:*:99:99:Unknown User:/var/empty:/usr/bin/false

Finally I found /etc/master.passwd. I just modified root and mobile to use /bin/bash instead of /bin/sh and on my next login I was using bash!

[10:41][root@iPhone:~]$ cat /etc/master.passwd 
# User Database
# This file is the authoritative user database.
nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false
root:5IS3K.2i/ciLw:0:0::0:0:System Administrator:/var/root:/bin/bash
mobile:NhbBgPU3IOnek:501:501::0:0:Mobile User:/var/mobile:/bin/bash
daemon:*:1:1::0:0:System Services:/var/root:/usr/bin/false
_sshd:*:75:75::0:0:sshd Privilege separation:/var/empty:/usr/bin/false
_unknown:*:99:99::0:0:Unknown User:/var/empty:/usr/bin/false

3 thoughts on “Changing the default shell on iPhone”

  1. Hello,

    I was wondering if you could help me?

    I wanted to ask a question i have an iphone 3 gs and have the message “charging is not supported with this accessory” appearing on my home screen randomly and there is no accessory attatched ? can you help ?

    KInd REgards


  2. Thanks for this tip!

    I had the problem that with the default shell /bin/sh the shell variable POSIXLY_CORRECT was always set. This in turn prevented the tab completion if I specified “set editing-mode vi” in my .inputrc.

    After I changed the shell in the master.passwd file to /bin/bash, everything works ok now. I almost got crazy on this…

  3. @Andrew…

    Your question is a little misplaced in this thread.

    What I got from the internet is that there may be a possibility, that your iPhone got wet and you have a hardware problem. Can’t confirm this, just rumors…

Comments are closed.