Accidentally modified .bashrc and now I cant login despite entering password correctly

indrafani03

New Member
Sep 12, 2023
1
0
1
I messed up bigtime with the bashrc file. I was installing Gurobi and I had to set path variables in the bashrc file. So, I replaced all the text in bashrc with the path variables and saved the bashrc file. And I also made sure, if anything bad happens, I have a backup of this file. The original unmodified backup file is in the Downloads folder.

Now when I restarted the system, I was not able to login despite giving the proper password. Hence, I'd like to ask you for some help. What kind of fixes are possible given the fact that I still have the bashrc file in the Downloads directory
 
If your don't have this problem with the root user, or have other sudo users on the system, then you can easily do it via another user.
The general recipe for root (as the only user) is: boot the system with a Linux Live CD (or Proxmox installer), mount the filesystem(s), replace /root/.bash_rc with the copy from the Downloads folder. The details depend on which filesystem your Proxmox uses and where your "Downloads folder" is. This is not specific for Proxmox, there might be some good Linux guides somewhere.
 
Although a live linux works, the easiest fix is to just move your .bashrc via sftp:

Code:
ssh <host> mv .bashrc .bashrc.old

or just login via sftp and move/delete it then

Code:
sftp <host> ...