Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

3 Answers 3

up vote 4 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
add comment

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

if [ -z "$SSH_CLIENT" ] ; then  
...
fi

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
add comment

This is what I ended up doing:

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

Your Answer

 
discard

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.