I have created a new user account. I can't access it because of a .bash_profile error. How can I repair this type of error?


Since it's you who created the account, I'm assuming you have root access on the system.

Log in as root and edit the file, correcting the error.

To correct this as the affected user:

  • Some graphical logins provide the ability to choose an alternate login shell. Pick one that is not bash and log in, fix the error and log out again. Then pick bash as login shell on the next login.

  • If this is a remote system, use

    • ssh -t user@host vim .bash_profile, or
    • ssh -t user@host "sh -c 'vim .bash_profile'", edit the file and exit.
    • Alternatively, ssh user@host mv .bash_profile .bash_profile-broken, or
    • upload a new .bash_profile using scp (possibly a corrected version of the one fetched using scp).

Not the answer you're looking for? Browse other questions tagged or ask your own question.