Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 want to ssh into my account, but I don't want the current version of my .profile login script to be executed. Is there a way to log in without running .profile?

(Disclaimer: I found a work-around which I posted below, but I wonder if there's a better answer)

share|improve this question
up vote 10 down vote accepted

You can run the followin command:

ssh -t user@host bash --noprofile

where -t option to ssh is to force tty allocation.

share|improve this answer

This is what I ended up doing:

scp me@machine:.profile .
# Fix .profile
scp .profile me@machine:.
ssh me@machine
share|improve this answer

To permanently avoid trouble, in my .bashrc on the target system, I have:

if [ -z "$SSH_CLIENT" ] ; then  

surrounding ssh-incompatible stuff. SSH_CLIENT is defined for shells invoked via ssh, and not for other shells.

ssh user@somewhere "env >env.ssh"

walk over so somewhere, login as user, and:

env >env.local
diff env.local env.ssh
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.