Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I added the following line to the end of my ~/.bashrc (This is on a Linode box) and logged out of my ssh session.

source ~/.profile

Now when I log in, the shell is unresponsive. I never get to the prompt and entering commands does nothing.

If I Ctrl-c then it closes the ssh connection. Ctrl-z does nothing either. I can't get access to the ~/.profile to try and see what the issue is.

How can I get the prompt back?

share|improve this question
up vote 2 down vote accepted

To get your shell back, just use this procedure.

Hope you remember the contents of .bashrc what were earlier there. It should be something like this:

# .bashrc

# Source global definitions
    if [ -f /etc/bashrc ]; then
        . /etc/bashrc

Put them into a file with the same name, .bashrc, on the machine from where you can access your Linode machine.

Now use this command:

 # scp .bashrc server:.

This will replace your modified .bashrc with this default one and you should be able to get your shell back.

Please let me know in case you face any issues with this.

share|improve this answer
Yeah I was thinking of going this route but just wanted to check that there wasn't an obviously better way. Luckily there weren't many modifications and I found a default bashrc. – duckyfuzz Mar 26 '13 at 4:38
Great. Glad to help. – GeekRide Mar 26 '13 at 6:54
using similar mechanism, you could first scp FROM the machine to another one, and thus have its real content, take out the offendign line, and scp it back on the machine. – Olivier Dulac Mar 26 '13 at 13:39

Usually you can tell bash to ignore these rc files with:

ssh -t your-host bash --noprofile --norc

After login, you can view and update the problematic rc files.

share|improve this answer
This is a better solution in my opinion. You don't lose the offending files which allows you to recover useful parts and troubleshoot what caused the problem in the first place. – Kenny Rasschaert Mar 26 '13 at 7:08
This would be perfect except that I'm trying to log into a VM on an OS X host, and the ssh command on OS X does not understand the --noprofile or --norc options. Any idea how else to accomplish the same thing as providing those options? – Steve Jorgensen Jul 17 '14 at 18:30
@Steve: --norc and --noprofile are bash's options instead of ssh's. – whjm Jul 17 '14 at 23:29
Ah. I need to read more carefully. – Steve Jorgensen Jul 18 '14 at 3:45

People already have asked you how to fix this. But why this has happened to you?

In Debian/Ubuntu, there's this piece of code in ~/.profile:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
    . "$HOME/.bashrc"

So, by default, ~/.profile is including ~/.bashrc. If you tell ~/.bashrc to include ~/.profile, you are creating an infinite loop.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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