The problem is that with multiple hosts being accessed through localhost, my known_hosts file always has the wrong host in it. As a result, I get the following message (call me paranoid, but I usually keep my ssh host checking strict):
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
... etc.
... etc.
This continues for many lines, and is somewhat annoying. So this is what I did. I made a little perl script (rsa_remove) that removes any line with localhost in it from my known_hosts file. I then use aliases such as the following to call the script and then the ssh command with the new port:
alias alias_name='rsa_remove;ssh localhost -oPort=1024'
Here is the rsa_remove perl script (barely a script, I know):
perl -e "s/^localhost.*n//g;" -pi ~/.ssh/known_hosts
Hope this helps someone...
[robg adds: I haven't tested this one...]

