Bash – Run ssh login command without modifying remote .bashrc

bashbashrcssh

We have a bunch of servers set up with set -o vi in their ~/.bashrc.

It would be nice to be able to ssh into these boxes and automagically run set -o emacs as a timesave.

I've seen a solution indicating that such additions should be made on the remote host ~/.bashrc but we cannot modify these for various reasons.

Another solution suggests using:

spawn ssh -t user@host "set -o emacs; /bin/bash -i"

..but I understand this requires running the expect shell instead of plain bash.

Is there a simple way to achieve this goal? Any suggestions would be very much appreciated.

Best Answer

ssh -t user@host bash -o emacs -i
Related Question