1

Trying here, without success, change the sshd port from 22 to 2222 on Debian 10 "Buster".

Already tried changing /etc/ssh/sshd_config line from # Port 22 to Port 2222, reboot machine, but it didn't worked out.

Already tried changing /etc/services ssh column from 22 to 2222, disabled then reenabled sshd.service, allowed it on iptables and ufw and it keeps on port 22.

Any idea about how to change ssh port 22 to 2222?

7
  • What have to done to see if sshd is listening on :2222? Is ssh.socket systemd unit disabled? Commented Oct 11, 2019 at 18:47
  • 4
    Port 2222 not port 2222 right ? Commented Oct 11, 2019 at 18:48
  • 1
    Checked via nmap command, yes, tried with ssh -p 2222 user@host with no success and yes, Port 2222 instead of port 2222. Commented Oct 11, 2019 at 19:11
  • 1
    Just changing the Port in sshd_config worked for me. Please add the output of egrep -v '^#|^$' /etc/ssh/sshd_config (cleared of any sensitive stuff) to your Q. BTW, you should never modify /etc/services -- that's only the business of IANA (and of misguided distro maintainers ;-)). Commented Oct 11, 2019 at 19:26
  • 1
    "but it didn't worked out" What actually happens when you change the port number in sshd_config and restart sshd? Do you get errors? Does sshd fail to start? How do you know it didn't work? Commented Oct 11, 2019 at 19:57

1 Answer 1

3

Just checked here that didn't added Port 2222 and commented out Port 22 in /etc/ssh/sshd_config.

Now it all seems to be clear and running on port 2222, my mistake.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.