I changed my SSH port in the /etc/ssh/sshd_config
file and then restarted the ssh service. I implemented fail2ban and updated the port to my SSH under that config. I also then implemented the UFW firewall and allowed incoming connections to my new SSH port.
However, when I try and login with my SSH key using ssh -i /Users/myuser/.ssh/vpsssh user@555.555.555.555
it's trying to connect to port 22 instead of the defined port I have.
Best Answer
You can specify a non-default port on the
ssh
client command line using the-p
option. Fromman ssh
:You may wish to put both the port number and the identity file location for the host in a
~/.ssh/config
file so that they don't need to be specified every time on the command line.Ex.
Then you will be able to use: