IBM Support

How to change FTP to use a different port number.

Troubleshooting


Problem

How can I configure FTP to use a different port number than the standard port 21?

Resolving The Problem

The following example replaces the standard FTP port 21 with port 10021:

1. Modify the port number for ftp in /etc/services file:

ftp 10021/tcp # File Transfer [Control]

ftp 10021/udp # File Transfer [Control]

2. Make a backup of the SRCsubsvr ODM file:

# cd /etc/objrepos

# cp SRCsubsvr SRCsubsvr.backup

3. Change the ODM class SRCsubsvr

- Export ODMDIR:

# export ODMDIR=/etc/objrepos

- Extract the ftp entry from the SRCsubsvr ODM class:

# odmget -q sub_type="ftp" SRCsubsvr > /tmp/ftp.odm.out

- Delete current ftp entry from the SRCsubsvr ODM class:

# odmdelete -q sub_type="ftp" -o SRCsubsvr

Expected output:

0518-307 odmdelete: 1 objects deleted.

Now, modify the sub_code field for the ftp stanza in /tmp/ftp.odm.out

Here is the initial entry in ftp.odm.out:

SRCsubsvr:

sub_type = "ftp"

subsysname = "inetd"

sub_code = 21

Change sub_code to the new port (for example, port 10021):

SRCsubsvr:sub_type = "ftp"

subsysname = "inetd"

sub_code = 10021

Save the file.

Add the new ftp entry to the SRCsubsvr ODM class:

# odmadd /tmp/ftp.odm.out

Verify whether the entry is present, and the new port number is shown:

# odmget -q sub_type="ftp" SRCsubsvr

4. Refresh inetd to restart ftpd

# refresh -s inetd

Verify that the new ftpd port is in the listen state:

# netstat -an | grep 10021

If the port is not in the listen state, you must restart inetd:

# stopsrc -s inetd

# startsrc -s inetd

5. Test the ftp connection to port 21 and 10021

[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Not Applicable","Platform":[{"code":"PF002","label":"AIX"}],"Version":"Not Applicable","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}},{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

More support for:
AIX

Software version:
Not Applicable

Operating system(s):
AIX

Document number:
631093

Modified date:
09 December 2019

UID

isg3T1025184

Manage My Notification Subscriptions