Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Trevor8888

macrumors newbie
Original poster
May 22, 2019
2
0
My only excuse for this is that I'm going through some personal issues right now and I wasn't thinking this through. This was a stupid thing to do. Please be kind.

So I got a new mac at work. We are an almost exclusive windows organization (government) but I fangled a mac and it seems I broke it.

Out network is set up so that we have a network profile. Network\Desktop. Anyway, for some reason my directed brain thought I should change my home directory to the network location for some reason. So I sort of followed this and changed my home directory from: /Users/username to a network directory name.

This was boneheaded dumb because I know the computer has to log into the network first before having access. What happens now when I try to log in is I get: "You are unable to log in to the user account "myusername" at this time. Logging in to the account failed because an error occurred"

I've done a but of googling and I found that I can access the terminal via Command-R. Can I fix this through the terminal?

Please help!
 
Since just changing the home directory, the regular way (that I know of anyway) via Terminal, requires first having access to the user's current home directory, which would likely be an involved process at this stage, I recommend we simply create a new user with admin rights and then you can log in as the new user and change the home directory for the other one graphically.

Here's how to create a new user through Terminal:
https://smallbusiness.chron.com/add-user-terminal-mac-os-x-screen-sharing-31846.html

Note that if you have a TimeMachine backup, you can also just revert back to before you made the change
 
Lots of stuff in the link.

Believe only need to run this from Terminal in Recovery Mode and re-start. Will get the Setup Assistant and can use the GUI to create an admin account. Then sign in and repair what was changed previously.

Code:
rm /var/db/.AppleSetupDone
 
Hi! Welcome to MacRumors. No worries, it happens to the best of us :)

Here's what you need to do:
  • Shut down your Mac.
  • Turn it on. Immediately press COMMAND and S at the same time. This will take you to Single User Mode.
  • Type: rm /var/db/.AppleSetupDone (then hit Enter)
  • Type: reboot (then hit Enter)
  • You'll then see the Setup Assistant. Type in a new username (not your original username). For example, "tempuser". Make sure this user is an administrator.
  • It'll create the new account.
  • Go to System Preferences, then Users, then rename the messed-up account to the original username.
  • Switch users, then try logging into your original account.
Hopefully this helps? :) I hope things get better for you soon. Let us know if you have any more questions.
 
Last edited by a moderator:
Believe only need to run this from Terminal in Recovery Mode and re-start. Will get the Setup Assistant and can use the GUI to create an admin account. Then sign in and repair what was changed previously.

This should also work, yes, but I wasn't sure if the setup assistant might complain if it saw the other user already there, so I didn't recommend that route; But you're right, it's a good first one to try :)
 
Since just changing the home directory, the regular way (that I know of anyway) via Terminal, requires first having access to the user's current home directory, which would likely be an involved process at this stage, I recommend we simply create a new user with admin rights and then you can log in as the new user and change the home directory for the other one graphically.

Here's how to create a new user through Terminal:
https://smallbusiness.chron.com/add-user-terminal-mac-os-x-screen-sharing-31846.html

Note that if you have a TimeMachine backup, you can also just revert back to before you made the change
THanks for the followup - I tried this but the bash shell in recovery mode gives me the error:

-bash: sudo: command not found

I tried doing by entering interactive mode and going through the steps but it failed to create the account. :(

Lots of stuff in the link.

Believe only need to run this from Terminal in Recovery Mode and re-start. Will get the Setup Assistant and can use the GUI to create an admin account. Then sign in and repair what was changed previously.

Code:
rm /var/db/.AppleSetupDone
I tried this but I received a 'No such file or directory" error. I did go into the /var/db/ folder and confirmed there was no .AppleSetupDone file.
[doublepost=1558629765][/doublepost]
Hi! Welcome to MacRumors. No worries, it happens to the best of us :)

Here's what you need to do:
  • Shut down your Mac.
  • Turn it on. Immediately press COMMAND and S at the same time. This will take you to Single User Mode.
  • Type: rm /var/db/.AppleSetupDone (then hit Enter)
  • Type: reboot (then hit Enter)
  • You'll then see the Setup Assistant. Type in a new username (not your original username). For example, "tempuser". Make sure this user is an administrator.
  • It'll create the new account.
  • Go to System Preferences, then Users, then rename the messed-up account to the original username.
  • Switch users, then try logging into your original account.
Hopefully this helps? :) I hope things get better for you soon. Let us know if you have any more questions.
I tried going into single user mode. I've never done this before so I didn't know what to expect. It looked like it was doing something - rather than the usual apple logo it ran a lot of text on the screen - then it locked up for a minute - flashed red and booted up as normal.
 
Last edited by a moderator:
I tried this but I received a 'No such file or directory" error. I did go into the /var/db/ folder and confirmed there was no .AppleSetupDone file.

That's odd, it looks like they've moved it, but I have no idea where to. Maybe merged it with another file, i don't know, but it isn't there for me either.
You should still be able to create a new user via the steps in my link though

I tried going into single user mode. I've never done this before so I didn't know what to expect. It looked like it was doing something - rather than the usual apple logo it ran a lot of text on the screen - then it locked up for a minute - flashed red and booted up as normal.

That's definitely not supposed to happen. You did ⌘+S on boot, yes? Could you maybe photo the text before it flashes? Perhaps video if it's hard to get the photo in perfect time
[doublepost=1558631268][/doublepost]
THanks for the followup - I tried this but the bash shell in recovery mode gives me the error:

-bash: sudo: command not found

I tried doing by entering interactive mode and going through the steps but it failed to create the account. :(

What did it fail with in interactive mode? - It may very well be that it can't be done from Recovery Mode, since the directory service (that manages users) isn't active in that mode - We may need to figure something out about your single-user mode issue.
 
That's odd, it looks like they've moved it, but I have no idea where to. Maybe merged it with another file, i don't know, but it isn't there for me either.
You should still be able to create a new user via the steps in my link though



That's definitely not supposed to happen. You did ⌘+S on boot, yes? Could you maybe photo the text before it flashes? Perhaps video if it's hard to get the photo in perfect time
[doublepost=1558631268][/doublepost]

What did it fail with in interactive mode? - It may very well be that it can't be done from Recovery Mode, since the directory service (that manages users) isn't active in that mode - We may need to figure something out about your single-user mode issue.

Hi - thanks for the responses. As this is a government computer there is a hidden admin account (or a re-image option). These just take some time. I've put in a service request for someone to come and log in as admin and fix it. I think this is ultimately the simplest solution in the long run (although the wheels of government can move sloooowly).

Thank you very much for the help - I really appreciate it.
Best,
Trevor
 
Hi - thanks for the responses. As this is a government computer there is a hidden admin account (or a re-image option). These just take some time. I've put in a service request for someone to come and log in as admin and fix it. I think this is ultimately the simplest solution in the long run (although the wheels of government can move sloooowly).

Good things such safe-guards are in place. That does seem by far to be the simplest approach at this stage :).

Thank you very much for the help - I really appreciate it.

You're welcome.
 
That's odd, it looks like they've moved it, but I have no idea where to. Maybe merged it with another file, i don't know, but it isn't there for me either.
When you're in recovery, you're not booted from "Macintosh HD" so when you want to access a file on Macintosh HD, you need to start the path with
Code:
/Volumes/Macintosh\ HD/
rather than just "/".
 
When you're in recovery, you're not booted from "Macintosh HD" so when you want to access a file on Macintosh HD, you need to start the path with
Code:
/Volumes/Macintosh\ HD/
rather than just "/".

Oh I know that. When I said it wasn't there for me either, I didn't boot recovery mode or anything. I am not having the issue. - But it's a good thing to point out to others reading doing it from Recovery, if it's there for them
 
Just thought I would point out that file .AppleSetupDone still exists in the same /var/db folder.
It does begin with a (.), so it's not visible in the finder, unless you make it visible.
Shift+Command+. will toggle visibility in the finder.
 
  • Like
Reactions: NoBoMac
Just thought I would point out that file .AppleSetupDone still exists in the same /var/db folder.
It does begin with a (.), so it's not visible in the finder, unless you make it visible.
Shift+Command+. will toggle visibility in the finder.


What am I missing here?
 

Attachments

  • Screenshot 2019-05-24 at 12.50.48 AM.png
    Screenshot 2019-05-24 at 12.50.48 AM.png
    284.6 KB · Views: 197
Also, as mentioned, sorta, if a volume is encrypted (aka "Macintosh HD"), needs to be mounted and unlocked.

So, yes, single user mode, maybe mounted and there. In Recovery, maybe need to mount & unlock the drive, then access/remove, via /Volumes/nameofmaindrivehere

(aside: lots of this might be second nature, "oh yeah, duh" type stuff when we actually do it, but having to transfer that "duh" moments to a post (eg where the volume is), might sneak past the radar when posting)
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.