4

I really messed up! Since I ran my Mac with the command below

chsh -s /usr/local/bin/false

Several minutes later, I noticed my Mac logged out by itself. So, I tried to log back in by clicking 'change user' But I can't see my administer account there.

I guess 'false' is not a loggin-able shell, that's why my account is hidden.

I'm trying to change my shell with Terminal.app on recovery mode or single-user-mode (but both are read-only).

So right now, I want to know if there's any solutions that might be able to fix this problem.

  • Could you mount your disc on another mac and edit it that way? – Solar Mike Aug 8 '17 at 19:19
  • Your comment becomes a hint and I come up with a simple idea, recover my Mac from TimeMachine. Thanks a lot! – Yumenosuke Koukata Aug 9 '17 at 2:06
  • Please add your system version. BTW I can't comprehend this error: chsh -s /usr/local/bin/false doesn't do anything bad in my Sierra VM - user bash is still /bin/bash and reboot/login is possible... – klanomath Aug 9 '17 at 17:55
1

OK - bummer situation, but probably pretty easy to get around.

  1. Boot in single user mode, mount the drive as read&write by running /sbin/mount -uw /, remove the /var/db/.AppleSetupDone file and make a new admin account
  2. Use that admin account to change back the shell for your user.
  3. Log out and check your account.
  4. Clean up the “temporary” admin account if you wish.

Nothing can go wrong, except for perhaps FileVault or no backup or a firmware password so if you can finish a backup or might have another admin account already - using that would be much better in case the above outline isn’t workable for you.

iMac is stuck in a login loop

https://support.apple.com/en-us/HT202860

  • There might be a better way to safely chsh in single user mode, but I know this will work and haven’t tested the alternative. I’ll vote for a good answer that has a better option or feel free to edit mine to make it better if you know the steps are safe. – bmike Aug 8 '17 at 19:36
  • I couldn't remove that file from single-user-mode or recovery-mode because they are read only mode. (Perhaps I have a shallow understanding of the system.) However, I think that's right. If I can make admin account I can run any command as an administer and fix this situation. I don't want to give up to fix with the way for a better understanding of BSD, but I also need to recovery asap, I'm recovering from TimeMachine backup. Thanks a lot! – Yumenosuke Koukata Aug 9 '17 at 2:21
  • For next time @yumenosuke /sbin/mount -uw / it should be printed in the instructions a line or two before the prompt gets shown – bmike Aug 9 '17 at 3:18
  • oh, that's a good idea! I'll try next time! (I hope no next time...) Thanks! – Yumenosuke Koukata Aug 9 '17 at 10:13
  • Could ln /usr/local/bin/false to whatever shell it's suppose to go. – historystamp Dec 25 '18 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .