How to: Open Ssh Port 22 on Linux APF Firewall under CentOS / RHEL

by on December 7, 2007 · 3 comments· LAST UPDATED December 7, 2007

in , ,

Q. I'd like to change ssh port from 22 to 2346. I changes the ssh port and reloaded OpenSSH but didn't get through my firewall. I'm using APF firewall script under cPanel control panel? How do I open port 2346?

A. By default APF configured via /etc/apf/conf.apf file. All you have to do is login as the root and specify port number.

Open port 2346 using APF

Login as the root

Open config file /etc/apf/conf.apf
# vi /etc/apf/conf.apf
Find line that read as follows:
IG_TCP_CPORTS
Add port 2346 (keep all other ports):
IG_TCP_CPORTS="2346,22,25,53,80,443,993,904,...."
Close and save the file. Restart firewall:
# /etc/init.d/apf restart

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 3 comments… read them below or add one }

1 cubemed April 2, 2009 at 11:41 pm

Thank you for letting us know that.
very useful for me right now.

Reply

2 LaiQue September 14, 2011 at 2:16 pm

Thanks Dude, It worked.

Reply

3 Mark November 21, 2011 at 6:50 am

Look for IG_UDP_CPORTS if you need to open a port for UDP

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: