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)


You can run the followin command:

ssh -t user@host bash --noprofile

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

  • 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 '19 at 16:37

This is what I ended up doing:

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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