-1

This question already has an answer here:

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?

marked as duplicate by Jeff Schaller, Gilles, user34720, Rui F Ribeiro, Community Jun 26 '18 at 8:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

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.