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 _securityd:*:64:64:securityd:/var/empty:/usr/bin/false _mdnsresponder:*:65:65:mDNSResponder:/var/empty:/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 _securityd:*:64:64::0:0:securityd:/var/empty:/usr/bin/false _mdnsresponder:*:65:65::0:0:mDNSResponder:/var/empty:/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 |