星期四, 11月 02, 2023

2002-07-08 如何更改 AS/400 FTP Server 使用非預設 Port 21 接受 FTP 用戶端連線?


如何更改 AS/400 FTP Server 使用非預設 Port 21 接受 FTP 用戶端連線?

AS/400  FTP Server 使用預設 Port 21 接受 FTP 用戶端連線,由於網路安全的需求,
AS/400 也可以設定其他 TCP Port來與用戶端連線,指令 CHGFTPA 並不提供更改 Port 的
參數,我將較你如何更改預設 Port 21 至你自己定義的 Port no.

1. 輸入指令 WRKSRVTBLE 並往下翻頁至顯示 ftp-control 的 TCP 服務如下:
                         Work with Service Table Entries                         
                                                             System:   DDSCS20  
 Type options, press Enter.                                                     
   1=Add   4=Remove   5=Display                                                 
                                                                                
 Opt  Service                                  Port  Protocol                   
                                                                                
      drda                                      446  udp                        
      echo                                        7  tcp                        
      echo                                        7  udp                        
      exec                                      512  tcp                        
      finger                                     79  tcp                        
      finger                                     79  udp                        
      ftp-control                                21  tcp                        
      ftp-control                                21  udp                        
      ftp-data                                   20  tcp                        
      ftp-data                                   20  udp                        
      ftps-control                              990  tcp                        
                                                                        More... 
 Parameters for options 1 and 4 or command                                      
 ===>                                                                           
 F3=Exit   F4=Prompt   F5=Refresh   F6=Print list   F9=Retrieve   F12=Cancel    
 F17=Top   F18=Bottom                                                           

2. 顯示及列印這些服務

3. 使用指令 ADDSRVTBLE 新增 ftp-control 並指定你自己的 ftp-control Port no,
    ===> ADDSRVTBLE SERVICE('ftp-control') PORT(21021) PROTOCOL('tcp') TEXT('File Transfer(control)') ALIAS('ftp' FTP 'FTP-CONTROL')

4. 比較步驟三新增服務與原來 Port 21 的內容除了 Port 不一樣外,其餘值需完全一樣,英文字小寫需要用單引號前後括住。

5. 刪除原有 Port 21 的服務(從畫面選項 4 = Remove)。

6. 輸入指令 ENDTCP(終止 TCP 功能) 及 STRTCP(啟動 TCP 功能)。

7. 如果您希望,也可以依照上述步驟更改 ftp-data。

當您從 AS/400 執行 FTP 功能時,您需要指定 Port no,執行指令如下:

V4R5 : FTP RMTSYS('10.10.10.10 21021')
V5R1 : FTP RMTSYS('10.10.10.10') PORT(21021)

當您從 Dos 執行 FTP 至 AS/400 功能時,您需要指定 Port no,執行指令如下:

C:WINDOWS>ftp
ftp> open 10.10.10.10 21021 

當您更改 AS/400 FTP Port 21 至 21021 後,您需要更改有用到 AS/400 FTP Server 的相關程式,將原有 Port 21 更改至 Port 21021,例如原來是:

FTP RMTSYS('10.10.10.10')
使用預設 Port 21 ,不用指定 Port 參數。

更改後是:

FTP RMTSYS('10.10.10.10') PORT(21021)



沒有留言: