Centos Failed to Modify the port of SSH: error: Bind to port 27615 on failed: Permission denied.

Error screenshot

problem causes

selinux problem


Modify the port of sshd in selinux

# Install the modification tool
$ yum -y install policycoreutils-python

# Check the port of sshd in selinux, the output is 22
$ semanage port -l | grep ssh

# New ports
$ semanage port -a -t ssh_port_t -p tcp 27615

$ systemctl status sshd
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2022-10-29 10:10:08 CST; 36min ago
     Docs: man:sshd(8)
 Main PID: 8653 (sshd)
   CGroup: /system.slice/sshd.service
           └─8653 /usr/sbin/sshd -D

Oct 29 10:10:08 centos-linux.shared systemd[1]: Starting OpenSSH server daemon...
Oct 29 10:10:08 centos-linux.shared sshd[8653]: Server listening on port 27615.
Oct 29 10:10:08 centos-linux.shared systemd[1]: Started OpenSSH server daemon.
Oct 29 10:31:44 centos-linux.shared sshd[18735]: Accepted password for root from port 50375 ssh2

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *