FTP Connections
Most transactions on Pubnet occur using ftp (File Transfer Protocol) connections. Many local networks are protected by Firewall software, which may need to be configured to allow the ftp connections to function without interruption. This document contains all the necessary information to create ftp connections to Pubnet's Production and Sandbox/testing environments.
You should provide it to whoever manages your local network, so they can allow your network to communicate freely with ours, while remaining protected from the world-at-large.
For additional information about Firewalls, please refer to “Firewalls for FTP Servers,” a separate document found under Technical Information at this web site.
Questions not addressed in this document can be sent to support@mvb-online.com.
FTP Servers
Test environment (Sandbox)
FTP
URL: sandbox-ftp-edi.pubnet.org
Firewall Settings
IP: 34.75.173.4
Ports: passive:22000-22500 & 23000-23500
active:20, 21 & 1024-65536
SFTP
Live environment
FTP
URL: ftp-edi.pubnet.org
Firewall Settings
IP: 35.227.20.44 (updated 10/3/2020)
Ports: passive:20000-20500 & 21000-21500
active:20, 21 & 1024-65536
SFTP
URL: sftp-edi.pubnet.org
Logging in
Using Windows command line
Manual login
C:\Users\UserName>ftp
ftp> open sandbox-ftp-edi.pubnet.org
Connected to sandbox-ftp-edi.pubnet.org.
220 Service ready for new user (PubX 1.5.0).
530 Access denied.
User (sandbox-ftp-edi.pubnet.org:(none)): <mailboxID>
331 Please specify the password.
Password:
230 User logged in, proceed.
ftp> -- FTP commands (see section on FTP Commands) --
Note: 530 Access denied. error message appears, because Windows 10 sends the command OPTS UTF-8 ON to the server prior to logging in. This can be ignored.
FTP script
C:\Users\UserName>ftp -s:ftpscript.txt
example ftpscript.txt:
open sandbox-ftp-edi.pubnet.org
<mailboxID>
<mailboxPassword>
-- FTP commands (see section on FTP Commands) --
quit
Script notes:
- When using active mode, you need to use a public IP address to communicate with Pubnet’s FTP server.
- Passive mode is not possible from the Windows command line (even in scripts).
- If your script does not return files, because it is trying to download the heading returned by ls, try using the quote opts nlst simple command listed in “Multiple file commands using mget and mdelete” under the FTP commands section.
- For SFTP transfers, we cannot return an error code after a file is uploaded. To determine the status of your transfer, check the file name in your /sent directory. See “File naming conventions” under “Using FTP clients” section below to determine the error code.
Using FTP clients
General information for all clients:
The directories:
/ (root) This is where you upload your files.
/new This is where incoming files are stored that have not been downloaded yet.
/downloaded This is where files are stored that have been previously downloaded.
/deleted This is where files are stored that have been deleted.
/error This is where files are stored that returned a non-0000 error code during upload.
/sent This is where files are stored after they have been uploaded. Files placed in the /
(root) directory are moved to this folder automatically. Do not upload to this
directory.
File naming conventions
example file: 000000000007742549.0000.000084904.856
where,
- 000000000007742549 is the service reference number.
- 0000 is the error code (0000 is a successful upload). See the “FTP Error Codes,” a separate document found under Technical Information at this web site. It will provide descriptions for the error codes.
- 000084904 is the interchange control number.
- 856 is the interchange type.
FileZilla
FTPS (or FTP)
- Create a new connection using the settings in the screenshot below. Use your mailbox ID and mailbox password. The connection will use FTPS.

- When logging in for the first time, accept the security certificate and tick the checkbox to remember it, if desired. Afterwards, an empty directory listing will appear.
- The file C:\Users\<username>\AppData\Roaming\FileZilla\sitemanager.xml needs to be modified in order for the directory structure to be correctly displayed.
Note: The 'AppData' folder is hidden by default. Select the option to show hidden files in Explorer to be able to navigate to the FileZilla directory.
- Close FileZilla before proceeding.
- Open the file sitemanager.xml in a text editor. This is an XML file that contains the connection you just setup. It should be similar to the text below:
<FileZilla3 version="3.41.1" platform="windows">
<Servers>
<Server>
<Host>sandbox-ftp-edi.pubnet.org</Host>
<Port>21</Port>
<Protocol>0</Protocol>
<Type>0</Type>
<User>Mailbox ID</User>
<Pass encoding="base64">xxxxxxx</Pass>
<Logontype>1</Logontype>
<TimezoneOffset>0</TimezoneOffset>
<PasvMode>MODE_DEFAULT</PasvMode>
<MaximumMultipleConnections>0</MaximumMultipleConnections>
<EncodingType>Auto</EncodingType>
<BypassProxy>0</BypassProxy>
<Name>Pubnet Sandbox FTP</Name>
<Comments />
<Colour>0</Colour>
<LocalDir />
<RemoteDir />
<SyncBrowsing>0</SyncBrowsing>
<DirectoryComparison>0</DirectoryComparison>
</Server>
</Servers>
</FileZilla3>
- Anywhere between the <Server></Server> tag set for the connection you just created, insert the following:
<PostLoginCommands>
<Command>OPTS OUTPUT FTP</Command>
</PostLoginCommands>
- If you have more than one connection setup in FileZilla, be sure to add the block of text to the Pubnet connection you just added. Save the file and open FileZilla again.
- Connect using the newly modified connection.
SFTP
- To create a SFTP connection, use the SFTP server URL listed above and choose SFTP as the protocol. There is no need to edit the sitemanager.xml file after creating the connection.
WinSCP
FTPS (or FTP)
- Create a new connection using the settings in the screenshot below, using your mailbox ID and mailbox password, to create a FTPS connection:

- Click on the 'Advanced' button to enter the post login command OPTS OUTPUT FTP under 'Environment' - 'FTP' as in the screenshot below

SFTP
- To create a SFTP connection, use the SFTP server URL listed above and choose SFTP as the protocol. There is no need to add a post login command for SFTP.
FTP Commands
To change local directory after logging in to FTP server
ftp> lcd <directory>
Single file commands
File concatenation
To concatenate all files in to one file while downloading
ftp> get * concatenated_file.txt
Note: This feature is not available for SFTP connections.
Individual file download
Individual files can be downloaded by Service Ref. #
ftp> get 000000000000044406
Note: Files previously downloaded will be downloaded again, if referenced directly by Service Ref. #
Script note: When combined with the quote opts nlst simple new command, the results of the ls command can be stored in an array and files retrieved in a foreach loop using the get command.
Individual file upload
Individual files can be uploaded using the local file name. Use the lcd command to navigate to your local directory containing the files to be uploaded.
ftp> put <file name>
Multiple files upload
Multiple files can be uploaded from the current local directory. Use the lcd command to navigate to your local directory containing the files to be uploaded.
ftp> put *
To retrieve files by APRF
ftp> ls
200 Command PORT okay.
150 File status okay; about to open data connection.
Service Ref. # St APRF SNRF Mailbox ID
000000000000044406 N 850 000056338 ERETAIL
000000000000044407 N 850 000056338 ERETAIL
000000000000044875 N 850BK3060 000000076 1761323
000000000000044878 N 850BK3060 900000076 1761323
000000000000048326 N 850 101309050 URETAIL
ftp> get %%850 850s.txt
- grabs all 850 APRFs with status 'N' and concatenates them to a file named 850s.txt
ftp> get %%850BK3060 850BK3060s.txt
- grabs all 850BK3060 APRFs with status 'N' and concatenates them to a file named 850BK3060s.txt
ftp> get %%850% all_850s.txt
- grabs all APRFs starting with 850 with status 'N' and concatenates them to a file named all_850s.txt
Multiple file commands using mget and mdelete
To list all the files in current directory.
ftp> ls
200 Command PORT okay.
150 File status okay; about to open data connection.
Service Ref. # St APRF SNRF Mailbox ID
000000000000044406 N 850 000056338 ERETAIL
000000000000044407 N 850 000056338 ERETAIL
000000000000044875 Y 850BK3060 000000076 1761323
000000000000044878 Y 850BK3060 900000076 1761323
000000000000048326 N 850 101309050 URETAIL
Note: The file names are listed under the “Service Ref. #” column. The “St” is the file’s status; “Y” is retrieved, “N” has not been retrieved.
The first step is to modify 'ls' to only list the file names instead of the columns shown above.
for mget
To list files not previously downloaded (Status 'N'):
ftp> quote opts nlst simple new
200 NLST format set to simple: true; only new files: true
ftp> ls
200 Command PORT okay.
150 File status okay; about to open data connection.
000000000000044406
000000000000044407
000000000000048326
for mdelete
To list files previously downloaded (Status 'Y'):
ftp> quote opts nlst simple old
200 NLST format set to simple: true; only new files: false
ftp> ls
200 Command PORT okay.
150 File status okay; about to open data connection.
000000000000044875
000000000000044878
If desired, turn off interactive prompting mode using the command:
ftp> prompt
Note: If this step is omitted, you will be prompted before each file is downloaded or deleted, respectively. The prompt command is a toggle.
To retrieve all files
ftp> mget *
To delete all files
ftp> mdelete *
To restore default ls behavior
ftp>quote opts nlst default
List of other supported FTP commands:
LIST NLST MLSD STOR RETR DELE | USER PASS OPTS TYPE FEAT SYST | NOOP PWD QUIT PORT PASV ALLO |