Created attachment 1556 [details] patchfile which fixes the assumption that after ssh'ing into a machine, the cwd is ~/ ssh-copy-id currently assums that when copying over the key, it is sufficient to check for a .ssh dir at the current location (normally the user's home directory) and then proceed to copy the public key to the .ssh/authorized_keys file, creating the .ssh directory if needed. Under some circumstances, the current working directory of the shell after logging into the server over ssh will *NOT* be the user's home directory, so it can't be assumed that we're always operating in the user's home directory. As an example, let's say that there is a server that I log in to only to work on documentation. Since every time I log in to that machine, I'll be working in /home/me/documentation, I decide to stick a new line in my ~/.bashrc that simply does a "cd ~/documentation" after initializing aliases and everything else. In this case, when the ssh-copy-id script is run, a new directory ~/documentation/.ssh is created, and my public key is copied to a new file called ~/documentation/.ssh/authorized_keys. Now, as expected, when I try to ssh into the machine, key-based authentication is never attempted and I'm forced to manually move my key over from ~/documentation/.ssh/authorized_keys to ~/.ssh/authorized_keys which defeats the purpose of using ssh-copy-id. Attached is a patch which fixes this issue. Thanks!
patch applied, will be in openssh-5.6
Move resolved bugs to CLOSED after 5.7 release