passwordless ssh for another username?

You just have to supply the other system's username in the svn command:

$ svn co svn+ssh://otheruser@othersystem/path/to/repo

To answer your question's title, too:

$ ssh otheruser@othersystem

This causes sshd on the remote machine to look in ~otheruser/.ssh/authorized_keys for the public key corresponding to the private key on the machine you're typing the command on.


There are two ways to do this:

1) put user@ into the svn url ; this tells svn+ssh to login as that user. I think it's kind of a bad idea from a maintenance perspective because things like externals that point at other parts of the repository won't work correctly.

2) make a ~/.ssh/config (documented as ssh_config) that says something like:

Host othersystem
  User otheruser

this way any attempt to ssh to othersystem will default to using otheruser. Which is handy for you when do ssh manually as well as when you're using svn.


You don't have to have the same username on both mashines. As long as you generate the key (ssh-keygen) you have to copy line from ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub (depending on type of key) from local server and append it to ~/.ssh/authorized_keys on remote.

% ssh-keygen
% cat ~/.ssh/id_*.pub | ssh remoteuser@remoteserver 'cat > .ssh/authorized_keys'

If you don't want to type remoteuser each time append to ~/.ssh/config:

Host remoteserver
    User remoteuser

PS. The name of key may be in form of localuser@localhost but it is only a name. It can be just as well myfavouritekey@myfavouritecomputer and noone would care.