Is there a command to disable/enable a port? I want to disable a port from a script and don't want to edit the /etc/inetd /etc/services file.
You can stop a service ("subsystem") using stopsrc. If that subsystem process is listening on a port then you have effectively stopped the port.
The following stops the process with pid 299216 (which was xntpd at the time of writing):
stopsrc -p'299216'
using the /usr/sbin/chsubserver command disables the entry in the /etc/inetd.conf