I put "exit" in my .bashrc file. I don't have physical access to the machine so to connect to it I use ssh. I don't have root privileges. Every time I connect to the server, the connection automatically closes.
So far, I've tried:
- Overwriting .bashrc with scp and sftp. The connection closes before I can do anything.
- Using a few different GUI programs to access ssh (connection closes)
- Overwriting the file with ftp. (can't use ftp)
- From my home computer
- $ ssh host "bash --noprofile --norc" (connection closes)
- $ ssh host "mv .bashrc bashrc_temp" (connection closes)
- $ ssh host "rm .bashrc" (same thing)
- $ ssh host -t (connection closes)
Is there anything I can do to disable .bashrc or maybe overwrite the file before .bashrc is sourced?
I tried your suggestion, but no luck. The bashrc file still runs first.
Another thing I tried was logging in with another account and sudo editing the .bashrc, but I don't have sudo privileges on this account.
I guess I'll contact the admin.
I can't believe it, but this approach worked! Even though "exit" occurs within the first few lines (composed only of a few if blocks and export statements) in the .bashrc file, I still managed to Ctrl-c interrupt it successfully within twenty tries (took about 3 minutes). I removed the offending line in the .bashrc and everything is in working order again.