13

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)

3 Answers 3

20

You can run the followin command:

ssh -t user@host bash --noprofile

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

1
  • Thank you! This helped me log into my server which had a full disk. Took me a while to realize my .bashrc may have been triggering disk writes.
    – Ben Davis
    Mar 20, 2019 at 16:37
4

This is what I ended up doing:

scp me@machine:.profile .
# Fix .profile
scp .profile me@machine:.
ssh me@machine
3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .