I am trying to change the port of SSH on an EC2 instance, but I am not getting this to work.
What I am doing is the following:
Open the file /etc/ssh/ssh_config
Uncomment and change the line Port 2345
Save and close
run the command service sshd restart
Now I can still connect to port 22. And when I run the command ssh -p 2345 localhost
i get:
ssh: connect to host localhost port 2345: Connection refused
Best Answer
It may be a typo, but if you want to change the port that sshd listens on, you need to edit the
Port
setting in/etc/ssh/sshd_config
, notssh_config
.Also, you're using two different port numbers above (2345 and 2232), but I'm sure that's a typo.
If it's not that, could you edit into your question the output of
iptables -L -n -v
so we can see your firewall rules?