I have a probpem with Manjaro Linux. I worked with Android Studio and I added some lines to bashrc file.

Now. Every time I try to login into that user it is stuck after I enter valid password. When I enter wrong one it says 'Wrong password' and tells me to log in again.

I am 90% sure that problem is in bashrc file but the thing is that I can't open it to edit it.

I logged into tty as a root but the bashrc file there is not same one as in my user's account.

So. Is there any way to edit my bashrc from tty or something simillar. I want to avoid reinstalling the system.

Thank you.

  • You should be able to edit it either from safe mode command prompt or an external live boot disc. – AFH Sep 20 '19 at 10:39
  • Safe mode command prompt? Are you thinking about tty? If so.. I can't.. None of the linux commands work in it unless I login as root but then it's the same bashrc that I don't want to edit. – Mileta Dulovic Sep 20 '19 at 10:43
  • Safe Mode or Recovery Mode is a separate advanced boot option in Ubuntu, so I assume there is something analogous in Manjaro. If not, that's why I suggested the alternative of using a live boot. – AFH Sep 20 '19 at 10:59

First off, I'm not completely sure what bashrc you're referring to. There's a .bashrc in a user's home: ~/.bashrc, there's also one in /etc/bash.bashrc.

I suppose you're referring to ~/.bashrc of your user. Then you already managed to do the first part, that is to log in as root. Then you just need to navigate to the user home and edit the file there.

I think you see a different ~/.bashrc because when you log in as root, you are in the root home, so when just typing sth like $ vi .bashrc you open the root's .bashrc file.

  • Thank you so much :). It did the job. I was blind :D – Mileta Dulovic Sep 20 '19 at 10:48
  • Not at all, good it's working now :) – pavelsaman Sep 20 '19 at 10:49

When I enter wrong one it says 'Wrong password' and tells me to log in again.

It may not be because of .bashrc. You (as root) can change the user's password:

# as root
passwd username

After this try to log in with username and the new password.

This fragment is in case it's really about the user's .bashrc.

~username/.bashrc should expand to the path of .bashrc in the home directory of the existing user username. This way you can locate the file (e.g. printf '%s\n' ~username/.bashrc).

Editing it as root may not be a good idea because it may not alter the file in place; it may create a new copy and then overwrite the old file. This may result in wrong ownership and permissions.

This should work:

# as root
sudo -u username nano ~username/.bashrc

(nano is just one possibility, use any editor you like).

Note: if there is encryption involved then it may be the user's home directory is decrypted and mounted only after the user logs in. In this case you need additional (encryption-related) steps to get to the right .bashrc file.

  • Thank you for your time. Problem was in bashrc as I suspected. :) – Mileta Dulovic Sep 20 '19 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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