Article

  • 10 years

    3 years

    YetiShare / Plugins / FTP Upload

    12284

How to setup ProFTPD with the FTP Plugin

Install ProFTPD & MySQL module (on CentOS):

yum install proftpd proftpd-mysql 
chkconfig proftpd on

On Ubuntu:

sudo apt-get install proftpd-basic proftpd-mod-mysql
sudo update-rc.d proftpd defaults

Configure the /etc/proftpd.conf file with proftpd.conf.alt1.txt.

Troubleshooting

Via the FTP client:

Status:Connection established, waiting for welcome message...
Response:220 ProFTPD 1.3.3g Server (sitename.com) [::ffff:1.0.0.254]
Command:USER admin
Response:331 Password required for admin
Command:PASS ************
>Response:530 Login incorrect.
Error:Could not connect to server

Check your proftpd.log file for clues. 

tail /var/log/proftpd/proftpd.log

If you see errors similar to this:

Dec 01 06:49:33 cdn.sitename.com proftpd[19226] cdn.sitename.com (redlorry919.plus.com[::ffff:1.0.0.254]): FTP session opened.
Dec 01 06:49:33 cdn.sitename.com proftpd[19226] cdn.sitename.com (redlorry919.plus.com[::ffff:1.0.0.254]): error creating '/ftp_accs/admin': Permission denied
Dec 01 06:49:33 cdn.sitename.com proftpd[19226] cdn.sitename.com (redlorry919.plus.com[::ffff:1.0.0.2549]): notice: unable to use '~/' [resolved to '/ftp_accs/admin/']: No such file or directory

Make sure you do not have SELinux running. You can disable it until the next reboot by calling this:

setenforce 0
If you're having connection or firewall issues, see here:

https://support.mfscripts.com/public/kb_view/43/
More info: http://www.electrictoolbox.com/switch-off-selinux-...

Error:  warning: unable to determine IP address of 'host'. Add the host to the server hosts file:
nano /etc/hosts
Error:
[ ok ] Stopping ftp server: proftpd.
[....] Starting ftp server: proftpdmail proftpd[1534]: Fatal: Group: Unknown group 'nobody' on line 20 of '/etc/proftpd/proftpd.conf'
In proftpd.conf ensure this is set:
# Set the user and group that the server runs as
User nobody
Group nogroup

 

Alternative proftpd.conf

Depending on your ProFTPD setup you may find the setup detailed in the FTP plugin settings does not fully function. Try replacing the contents of your /etc/proftpd.conf file with the attached proftpd.conf.alt1.txt. Ensure you replace all the values in square brackets so it can connect to your database. This is a standalone config file so there's no need for sql.conf and modules.conf.


Direct Admin - No package proftpd available

There is a restriction in config for yum on DirectAdmin servers that blocks packages with 'ftp' or 'mysql' in the name. You can fix this by editing the yum.conf file:

nano /etc/yum.conf


Remove *ftp* & mysql* on this line:

exclude=apache* httpd* mod_* mysql* MySQL* mariadb* da_* *ftp* exim* sendmail* php* bind-chroot*


Example:

exclude=apache* httpd* mod_* MySQL* mariadb* da_* exim* sendmail* php* bind-chroot*


Try the install again using epel:

yum --enablerepo=epel install proftpd proftpd-mysql


If you need to install the epelrepo see here - https://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/


Permission Denied on Home Directory - ProFTPD

You see the following error in the proftpd logs: (assume ftp_accs is the folder you've created for the FTP accounts)

notice: unable to use DefaultRoot '~/' [resolved to '/home/domains/website.com/public_html/ftp_accs/admin/']: Permission denied

It's likely the path /home/domains/website.com/public_html/ftp_accs/ has user access restrictions on your server. Move /ftp_accs/ into your server root or other location which doesn't cause the error.

Ensure you truncate the following database tables to remove the failed FTP user:

- plugin_ftp_account
- plugin_ftp_proftpd_user


Debian Views Total Pending Count, Fails Transfer

This is liklely a firewall issue. In /etc/proftpd/proftpd.conf after DefaultRoot, add:

PassivePorts                  30000 50000

Restart proftFTPd

service proftpd restart
Using iptables enable the ports on your firewall:

iptables -A INPUT -p tcp --dport 30000:50000 -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables-save

or
apt-get install iptables-persistent
iptables -A INPUT -p tcp --dport 30000:50000 -j ACCEPT
iptables -A INPUT -p tcp --dport 21 -j ACCEPT
iptables-save > /etc/iptables/rules.v4


Failed to retrieve directory listing

Try enabling the passive ports as detailed above.



Useful Commands

Restart ProFTPD:

service proftpd restart

Install ProFTPD & MySQL module:

yum install proftpd proftpd-mysql 

Start in debug mode: (stop the proftpd service first)

proftpd -n -d 20
SQL Log File:
/var/log/proftpd/sql.log
If you can login fine when ProFTPD is started in debug mode but not normally, look in the SQL Log File. If you have an error like this:
'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)'
This is because selinux is blocking it.

Force stop all any processes on port 21:
fuser -k 21/tcp

External Resources

http://www.howtoforge.com/virtual_hosting_with_pro...