Send mail changing port issue

Hi, having issues changing the sendmail port from the default of 25 on AlmaLinux 8.8.

Port 25 works fine but if i change the port in the config rhen I get the below error?

Ive done this before on other distros without issue.

Sep 06 09:52:59 mail01 systemd[1]: Starting Sendmail Mail Transport Agent…
Sep 06 09:52:59 mail01sendmail[28218]: starting daemon (8.15.2): SMTP+queueing@01:00:00
Sep 06 09:52:59 mail01 systemd[1]: sendmail.service: Can’t open PID file /run/sendmail.pid (yet?) after start: No such file or directory
Sep 06 09:52:59 mail01 sendmail[28218]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: cannot bind: Permission denied
Sep 06 09:52:59 mail01 sendmail[28218]: daemon MTA: problem creating SMTP socket
Sep 06 09:52:59 mail01 sendmail[28218]: NOQUEUE: SYSERR(root): opendaemonsocket: daemon MTA: server SMTP socket wedged: exiting
Sep 06 09:54:29 mail01 systemd[1]: sendmail.service: start operation timed out. Terminating.
Sep 06 09:54:29 mail01 systemd[1]: sendmail.service: Failed with result ‘timeout’.
Sep 06 09:54:29 mail01 systemd[1]: Failed to start Sendmail Mail Transport Agent.

Could it possibly be an SELinux issue? If you try it after running
get enforce 0
does it work? If so, you can change the port with (if the port you’re using is 17)
'semanage -a -t smtp_port_t -p tcp 17 (Should work, bu untested by me)

There is also the possibility that you didn’t reconfigure your firewall. (You’ll have to do that even if SELinux is part of the issue) to allow the different port.
Use firewall-cmd to open the firewall for the new port.

firewall-cmd --add-port=17/tcp

This is assuming you have not already checked if the issue is SELinux or firewall. I’m not 100% sure of my syntax either, you should double check with a web search

thanks it was SE Linux in the end I added a custom policy and it worked.

Glad to hear it. Thanks for coming back and letting people know what the issue was, no doubt it will help someone in the future.