I'd like to use key-based authentication to login to one of my computers. It has sshd running on a port that is not the default of 22.
I want to use
ssh-copy-id to add my key to the list of authorised keys. I tried to specify the port using
-p, as for the ssh command itself. However I get really strange error messages then.
user@box:~$ ssh-copy-id -p 57777 -i ~/.ssh/id_rsa.pub [email protected] Bad port 'umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys' user@box:~$ ssh-copy-id '-p 57777' -i ~/.ssh/id_rsa.pub [email protected] Pseudo-terminal will not be allocated because stdin is not a terminal. ssh: Could not resolve hostname umask 077; test -d ~/.ssh || mkdir ~/.ssh ; cat >> ~/.ssh/authorized_keys: Name or service not known
How can I make it work? (I know I can manually add the key to the authorized_keys file on the server. But I am lazy and definitely curious how to convince ssh-copy-id to do its job :) )