View Single Post
  #1  
Old 12th July 2007, 17:32
shaft_manlike shaft_manlike is offline
Junior Member
 
Join Date: Jul 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Virtual Hosting With PureFTP And MySQL (Incl. Quota) - user/group issue

I've just upgraded by reinstalling my server at work from Ubuntu Dapper to Feisty

I previously had PureFTP/MySQL sep up working perfectly but wasn't happy about it using ftpuser/ftpgroup because the server default is www-data and so and php scripts which has been FTP'd up cannot create or change files.

So this time went through all the steps apart from creating ftpuser and ftp group and I just can't get it working

When I try to log in using Filezilla I get the following

Status: Connecting to 192.168.1.123 ...
Status: Connected with 192.168.1.123. Waiting for welcome message...
Response: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
Response: 220-You are user number 1 of 50 allowed.
Response: 220-Local time is now 16:25. Server port: 21.
Response: 220-This is a private system - No anonymous login
Response: 220-IPv6 connections are also welcome on this server.
Response: 220 You will be disconnected after 15 minutes of inactivity.
Command: USER firstuser
Response: 331 User firstuser OK. Password required
Command: PASS ******
Response: 530 Sorry, but I can't trust you
Error: Unable to connect!

This is the entry in the DB

+-----------+--------+----------------------------------+-----+-----+--------------------------+-------------+-------------+---------+----------+-----------+------------+
| User | status | Password | Uid | Gid | Dir | ULBandwidth | DLBandwidth | comment | ipaccess | QuotaSize | QuotaFiles |
+-----------+--------+----------------------------------+-----+-----+--------------------------+-------------+-------------+---------+----------+-----------+------------+
| firstuser | 1 | 5ebe2294ecd0e0f08eab7690d2a6ee69 | 33 | 33 | /var/www/apache2-default | 100 | 100 | | * | 50 | 0 |
+-----------+--------+----------------------------------+-----+-----+--------------------------+-------------+-------------+---------+----------+-----------+------------+
1 row in set (0.00 sec)

As you can see the gid and uid are 33 and the password is encrypted, I used md5

ish@officedev2:~$ sudo id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

ish@officedev2:~$ ls -l /var/www
total 4
drwxr-xr-x 2 www-data www-data 4096 2007-07-12 15:20 apache2-default

I'll put the contents of /etc/pure-ftpd/db/mysql.conf at the end. Any ideas?

##############################################
# #
# Sample Pure-FTPd Mysql configuration file. #
# See README.MySQL for explanations. #
# #
##############################################


# Optional : MySQL server name or IP. Don't define this for unix sockets.

# MYSQLServer 127.0.0.1


# Optional : MySQL port. Don't define this if a local unix socket is used.

# MYSQLPort 3306


# Optional : define the location of mysql.sock if the server runs on this host.

MYSQLSocket /var/run/mysqld/mysqld.sock


# Mandatory : user to bind the server as.

MYSQLUser pureftpd


# Mandatory : user password. You must have a password.

MYSQLPassword ftpdpass


# Mandatory : database to open.

MYSQLDatabase pureftpd


# Mandatory : how passwords are stored
# Valid values are : "cleartext", "crypt", "md5" and "password"
# ("password" = MySQL password() function)
# You can also use "any" to try "crypt", "md5" *and* "password"

MYSQLCrypt md5


# In the following directives, parts of the strings are replaced at
# run-time before performing queries :
#
#
# \L is replaced by the login of the user trying to authenticate.
# \I is replaced by the IP address the user connected to.
# \P is replaced by the port number the user connected to.
# \R is replaced by the IP address the user connected from.
# \D is replaced by the remote IP address, as a long decimal number.
#
# Very complex queries can be performed using these substitution strings,
# especially for virtual hosting.


# Query to execute in order to fetch the password

MYSQLGetPW SELECT Password FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")


# Query to execute in order to fetch the system user name or uid

MYSQLGetUID SELECT Uid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")


# Optional : default UID - if set this overrides MYSQLGetUID

#MYSQLDefaultUID 1000


# Query to execute in order to fetch the system user group or gid

MYSQLGetGID SELECT Gid FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")


# Optional : default GID - if set this overrides MYSQLGetGID

#MYSQLDefaultGID 1000


# Query to execute in order to fetch the home directory

MYSQLGetDir SELECT Dir FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")


# Optional : query to get the maximal number of files
# Pure-FTPd must have been compiled with virtual quotas support.

MySQLGetQTAFS SELECT QuotaFiles FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")


# Optional : query to get the maximal disk usage (virtual quotas)
# The number should be in Megabytes.
# Pure-FTPd must have been compiled with virtual quotas support.

MySQLGetQTASZ SELECT QuotaSize FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")


# Optional : ratios. The server has to be compiled with ratio support.

# MySQLGetRatioUL SELECT ULRatio FROM users WHERE User="\L"
# MySQLGetRatioDL SELECT DLRatio FROM users WHERE User="\L"


# Optional : bandwidth throttling.
# The server has to be compiled with throttling support.
# Values are in KB/s .

MySQLGetBandwidthUL SELECT ULBandwidth FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")
MySQLGetBandwidthDL SELECT DLBandwidth FROM ftpd WHERE User="\L" AND status="1" AND (ipaccess = "*" OR ipaccess LIKE "\R")

# Enable ~ expansion. NEVER ENABLE THIS BLINDLY UNLESS :
# 1) You know what you are doing.
# 2) Real and virtual users match.

# MySQLForceTildeExpansion 1


# If you upgraded your tables to transactionnal tables (Gemini,
# BerkeleyDB, Innobase...), you can enable SQL transactions to
# avoid races. Leave this commented if you are using the
# traditionnal MyIsam databases or old (< 3.23.x) MySQL versions.

# MySQLTransactions On

Last edited by shaft_manlike; 12th July 2007 at 21:07. Reason: Incorrect Title
Reply With Quote
Sponsored Links