# FTP Troubleshooting

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">====================================================================================</span></span>

#### <span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">FTP Passive Mode</span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">Passive ports are used to allow multiple FTP connections <span class="EOP SCXO38321458 BCX0">by moving open FTP connections from port 21 to a port specified in the passive port range (40,000-40,100 is the standard ANS passive port range</span></span></span><span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0"> ). </span></span>

If your FTP client is using passive mode, you'll usually see an output similar to the below. We can use this to calculate the port being used for passive mode (which we can then check for any restrictions on).

`<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">80,244,185,220,156,149 </span></span>`

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">First 4 numbers are the server IP, </span></span><span class="EOP SCXO38321458 BCX0"> </span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">Multiply 5</span></span><span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun Superscript SCXO38321458 BCX0" data-fontsize="8.5">th</span></span><span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0"> number by 256 = x </span></span><span class="EOP SCXO38321458 BCX0"> </span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">X+6</span></span><span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun Superscript SCXO38321458 BCX0" data-fontsize="8.5">th</span></span><span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0"> number = passive port which is being used </span></span><span class="EOP SCXO38321458 BCX0"> </span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">156x256=39936+149=40085 </span></span><span class="EOP SCXO38321458 BCX0"> </span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">------------------------------------------------------------------------------------------------------------------------------------------------</span></span>

#### <span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">SFTP</span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">SFTP, which stands for Secure File Transfer Protocol, is a network protocol that provides file access, file transfer, and file management functionalities over any reliable data stream. Unlike FTP (File Transfer Protocol), which is often used with FTP over SSL/TLS (FTPS) for security, SFTP inherently provides secure file transfer through the SSH (Secure Shell) protocol.</span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">The primary cPanel/Plesk user can use SFTP if enabled.</span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">====================================================================================</span></span>

### <span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">FTP Troubleshooting</span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">------------------------------------------------------------------------------------------------------------------------------------------------</span></span>

##### <span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">cPanel</span></span>

Identify which FTP server is running

```
lsof -i:21
```

For Pure-FTPd:

```
/var/cpanel/conf/pureftpd/local
```

For ProFTPD:

```
/var/cpanel/conf/proftpd/local
```

Add this line to set which ports your server should use.

```
PassivePortRange: 40000 40100
```

If your server is behind a firewall and you are seeing unroutable address errors, add the following line, replacing `<span class="pre">123.123.123.123</span>` with your server’s public IP:

```
ForcePassiveIP: IP_IP_IP_IP
```

Restart `<span class="pre">Pure-FTPd</span>` by running:

```
/usr/local/cpanel/scripts/setupftpserver pure-ftpd --force
```

Allow inbound connections on the passive port range.

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">------------------------------------------------------------------------------------------------------------------------------------------------</span></span>

##### <span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">Plesk </span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">Plesk also uses the ProFTPD server, but the configuration is slightly different. </span></span>

**Plesk Onyx:**

Edit/create the file `<span class="pre">/etc/proftpd.d/55-passive-ports.conf</span>`

Add the following configuration this file:

```
<Global>
PassivePorts 40000 40100
</Global>
```

Restart the FTP service to pick up the changes:

```
systemctl restart xinetd
```

On your firewall, allow inbound connections on the passive port range.

If your server is behind a firewall and you are seeing unroutable address errors, add the following line, replacing `<span class="pre">123.123.123.123</span>` with your server’s public IP:

```
MasqueradeAddress IP_IP_IP_IP
```

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0">------------------------------------------------------------------------------------------------------------------------------------------------</span></span>

<span class="TextRun SCXO38321458 BCX0" data-contrast="none" lang="EN-GB" xml:lang="EN-GB"><span class="NormalTextRun SCXO38321458 BCX0"> </span></span><span class="EOP SCXO38321458 BCX0"> </span>