For security purposes, I don’t run sshd on the default port (22). This gave me some problems when attempting to use the command ssh-copy-id. Ideally, you’d expect the following to work:
ssh-copy-id -p XXXX -i '~/.ssh/id_rsa.pub' username@host
However, that didn’t do anything but output an error:
Bad port 'umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys'
The solution was to enclose it in quotes as follows:
ssh-copy-id ‘-p XXXX -i ~/.ssh/id_rsa.pub username@host’
Hope that helps.
(The above error probably doesn’t make any sense. ssh-copy-id is a shell script. The command that appears in the error message is a command sent to the server via SSH. Feel free to take a look at the file: cat `locate ssh-copy-id | head -n1`)
Another suggested option is:
ssh-copy-id -i ~/.ssh/id_rsa.pub ‘-p xxxx username@host’
Bad Behavior has blocked 87 access attempts in the last 7 days.