stupidly changed home directory

Discussion in 'macOS Mojave (10.14)' started by Trevor8888, May 22, 2019.

  1. Trevor8888 macrumors newbie

    Joined:
    May 22, 2019
    #1
    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!
     
  2. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #2
    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
     
  3. NoBoMac macrumors 68020

    Joined:
    Jul 1, 2014
    #3
    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
     
  4. KoolAid-Drink, May 22, 2019
    Last edited by a moderator: May 22, 2019

    KoolAid-Drink macrumors 65816

    Joined:
    Sep 18, 2013
    Location:
    California
    #4
    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.
     
  5. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #5
    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 :)
     
  6. Trevor8888, May 23, 2019
    Last edited by a moderator: May 23, 2019

    Trevor8888 thread starter macrumors newbie

    Joined:
    May 22, 2019
    #6
    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. :(

    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.
    --- Post Merged, May 23, 2019 ---
    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.
     
  7. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #7
    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
    --- Post Merged, May 23, 2019 ---
    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.
     
  8. Trevor8888 thread starter macrumors newbie

    Joined:
    May 22, 2019
    #8
    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
     
  9. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #9
    Good things such safe-guards are in place. That does seem by far to be the simplest approach at this stage :).

    You're welcome.
     
  10. chrfr macrumors 604

    Joined:
    Jul 11, 2009
    #10
    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 "/".
     
  11. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #11
    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
     
  12. DeltaMac macrumors G3

    DeltaMac

    Joined:
    Jul 30, 2003
    Location:
    Delaware
    #12
    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.
     
  13. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #13

    What am I missing here?
     

    Attached Files:

  14. dsemf macrumors 6502

    Joined:
    Jul 26, 2014
    #14
    ls -a ...
     
  15. chrfr macrumors 604

    Joined:
    Jul 11, 2009
    #15
    The command "ls" will not show hidden files. Try "ls -a".
     
  16. NoBoMac, May 23, 2019
    Last edited: May 23, 2019

    NoBoMac macrumors 68020

    Joined:
    Jul 1, 2014
    #16
    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)
     
  17. casperes1996 macrumors 68040

    casperes1996

    Joined:
    Jan 26, 2014
    Location:
    Horsens, Denmark
    #17
    I feel like an absolute knobbon now. Thanks for pointing that out to me. It's obvious now that you say it, but I somehow missed it earlier. Guess I'm sleep deprived.
    --- Post Merged, May 23, 2019 ---
    And thanks to you too as well; Sorry for my brainfarting :)
     

Share This Page

16 May 22, 2019