Steps I did:
In the /etc/ssh/sshd_config file, PORT 4000 was added under PORT 22
service ssh restart //Restarted ssh
-> ufw status
Status: inactive //The firewall is not turned on
ssh -p 4000 root@X.X.X.X Unable to log in through port 4000
ssh root@X.X.X.X Can log in through port 22
Personal operating experience on centos7, it should be selinux, which prevents ssh from binding other ports. It is recommended that you check whether ssh has bound the port, or query the ssh log. If you find that port 4000 is not bound to listen, please After closing selinux, start the service
I'll give it a try, is it ok?