If you really want to do it without modification on the server side, either:
1) Run something like
$ ssh user@host -t 'bash -l -o vi'
I don't think the documentation is too clear on that, but
-o option is mentioned, and seems to work.
2) Use expect:
$ cat bashsetup.expect
set user [lindex $argv 0];
set host [lindex $argv 1];
spawn ssh -l $user $host
expect "$ "
send "set -o vi\n"
Make it executable and run:
$ ./bashsetup.expect user testhost
spawn ssh -l user testhost
user@testhost ~$ set -o vi
This assumes you can login without entering passwords (for the remote host or for your keys), otherwise the expect script would need to take that into account. But with lots of machines you're likely to already have that. Also, I expected for a dollar sign and a space, edit that according to your prompt:
"# " perhaps.
Though if something printed before prompt includes those same characters, you'll need to include something more specific in the expected string.
Also, that script doesn't support giving extra arguments to
ssh. If you're going to give an explicit command to run, you probably don't need vi-mode, but if you need say port tunneling, that might be a problem.
But in any case, I really think this should be solved on the target systems with separate accounts (
sudo or just plain old UID 0). Personalised configuration would be useful for many other cases too, and in general you'd have a bunch of configuration files and environment variables you'd like to set. (Consider that the admins might not agree on the value of
$EDITOR, or the contents of
virc or whatever.)
Also removing users would be easier with separate accounts.
Any way of synchronising files on all the hosts would also trivially solve this by allowing you to login with something like
ssh -t user@host 'patricks_shell.sh' or
ssh -t user@host 'bash --rcfile patrick.rc'.