# proftpd 1.3.5 / mod_sql message: 'unknown named connetion"



## chrissie (Oct 8, 2014)

ProFTPD Version 1.3.5

FreeBSD server 8.4-RELEASE-p7

I installed proftpd on freebsd FreeBSD with this command:


```
cd /usr/ports/ftp/proftpd
make config
set MySQL auth
set Include mod_quota
make install clean
```

The following SQL configuration stanza in proftpd.conf:


```
<IfModule mod_sql.c>
    DefaultRoot ~
    RequireValidShell off
    AuthOrder mod_sql.c
    SQLBackend mysql
    SQLEngine on

SQLLogFile /var/log/proftpd-sql.log

    SQLAuthenticate on

    # SQLAuthTypes Crypt
    SQLAuthTypes Backend

    SQLAuthenticate users groups

    SQLConnectInfo froxlor froxlor SECRET
    SQLUserInfo ftp_users username password uid gid homedir shell
    SQLGroupInfo ftp_groups groupname gid members
#    SQLUserWhereClause "login_enabled = 'Y'"
```

I get the following error in the log file and have no idea: 
	
	



```
message: 'unknown named connection'
```

What am i missing?

Log File:


```
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: defaulting to 'mysql' backend
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: backend module 'mod_sql_mysql/4.0.8'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: backend api    'mod_sql_api_v1'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: >>> sql_sess_init
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: entering    mysql cmd_defineconnection
2014-10-07 13:52:11,504 mod_sql/4.3[40051]:   name: 'default'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]:   user: 'froxlor'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]:   host: 'localhost'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]:     db: 'froxlor'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]:   port: '3306'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]:    ttl: '0'
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: exiting     mysql cmd_defineconnection
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: connection 'default' successfully established
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: mod_sql engine     : on
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: negative_cache     : off
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: authenticate       : users groups userset groupset
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: usertable          : ftp_users
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: userid field       : username
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: password field     : password
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: UID field          : uid
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: GID field          : gid
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: homedir field      : homedir
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: shell field        : shell
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: group table        : ftp_groups
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: groupname field    : groupname
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: grp GID field      : gid
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: grp members field  : members
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: SQLMinUserUID      : 999
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: SQLMinUserGID      : 999
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: SQLDefaultUID      : 65533
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: SQLDefaultGID      : 65533
2014-10-07 13:52:11,504 mod_sql/4.3[40051]: <<< sql_sess_init
2014-10-07 13:52:11,506 mod_sql/4.3[40051]: >>> cmd_endpwent
2014-10-07 13:52:11,506 mod_sql/4.3[40051]: <<< cmd_endpwent
2014-10-07 13:52:11,506 mod_sql/4.3[40051]: >>> cmd_endgrent
2014-10-07 13:52:11,506 mod_sql/4.3[40051]: <<< cmd_endgrent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: >>> sql_pre_pass
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: <<< sql_pre_pass
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: >>> cmd_endpwent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: <<< cmd_endpwent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: >>> cmd_endgrent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: <<< cmd_endgrent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: >>> cmd_getpwnam
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: entering    mysql cmd_escapestring
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: exiting     mysql cmd_escapestring
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: unrecoverable backend error
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: error: 'mod_sql_mysql/4.0.8'
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: message: 'unknown named connection'
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: >>> cmd_endpwent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: <<< cmd_endpwent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: >>> cmd_endgrent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: <<< cmd_endgrent
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: entering    mysql cmd_exit
2014-10-07 13:52:13,847 mod_sql/4.3[40051]: exiting     mysql cmd_exit
```

Some maybe helpful output:


```
# proftpd -V
Compile-time Settings:
  Version: 1.3.5 (stable)
  Platform: FREEBSD8 (FREEBSD8_4) [FreeBSD 8.4-RELEASE-p7 amd64]
  Built: Tue Oct 7 2014 10:29:51 CEST
  Built With:
    configure  '--localstatedir=/var/run' '--libexecdir=/usr/local/libexec/proftpd' '--with-pkgconfig=libdata/pkgconfig' '--sysconfdir=/usr/local/etc' '--enable-ctrls' '--enable-dso' '--disable-sendfile' '--enable-ipv6' '--enable-nls' '--enable-pcre' '--disable-memcache' '--with-shared=mod_ban:mod_copy:mod_ctrls_admin:mod_deflate:mod_dnsbl:mod_dynmasq:mod_exec:mod_ifsession:mod_ifversion:mod_qos:mod_quotatab:mod_quotatab_file:mod_quotatab_radius:mod_quotatab_sql:mod_radius:mod_ratio:mod_readme:mod_rewrite:mod_sftp:mod_sftp_pam:mod_sftp_sql:mod_shaper:mod_site_misc:mod_snmp:mod_sql:mod_sql_passwd:mod_tls:mod_tls_shmcache:mod_unique_id:mod_wrap2:mod_wrap2_file:mod_wrap2_sql' '--with-includes=/usr/local/include' '--with-libraries=/usr/local/lib' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd8.4' 'build_alias=amd64-portbld-freebsd8.4' 'CC=cc' 'CFLAGS=-O2 -pipe -fno-strict-aliasing' 'LDFLAGS= -Wl,-rpath,/usr/lib:/usr/local/lib' 'LIBS=-lssl -lcrypto -L/usr/lib' 'CPPFLAGS=-DHAVE_OPENSSL -I/usr/include' 'CPP=cpp' 'CXX=c++' 'CXXFLAGS=-O2 -pipe -fno-strict-aliasing'

  CFLAGS: -O2 -pipe -fno-strict-aliasing -Wall
  LDFLAGS: -L$(top_srcdir)/lib  -Wl,-rpath,/usr/lib:/usr/local/lib -L/usr/local/lib
  LIBS: -lintl  -lpcreposix -lpcre -lssl -lcrypto -lpam -lsupp -lcrypt -lssl -lcrypto -L/usr/lib -liconv -lutil

  Files:
    Configuration File:
      /usr/local/etc/proftpd.conf
    Pid File:
      /var/run/proftpd.pid
    Scoreboard File:
      /var/run/proftpd.scoreboard
    Header Directory:
      /usr/local/include/proftpd
    Shared Module Directory:
      /usr/local/libexec/proftpd

  Features:
    - Autoshadow support
    + Controls support
    + curses support
    - Developer support
    + DSO support
    + IPv6 support
    + Largefile support
    - Lastlog support
    - Memcache support
    + ncursesw support
    + NLS support
    + OpenSSL support
    + PCRE support
    - POSIX ACL support
    - Shadow file suppport
    - Sendfile support
    + Trace support

  Tunable Options:
    PR_TUNABLE_BUFFER_SIZE = 1024
    PR_TUNABLE_DEFAULT_RCVBUFSZ = 8192
    PR_TUNABLE_DEFAULT_SNDBUFSZ = 8192
    PR_TUNABLE_GLOBBING_MAX_MATCHES = 100000
    PR_TUNABLE_GLOBBING_MAX_RECURSION = 8
    PR_TUNABLE_HASH_TABLE_SIZE = 40
    PR_TUNABLE_NEW_POOL_SIZE = 512
    PR_TUNABLE_SCOREBOARD_BUFFER_SIZE = 80
    PR_TUNABLE_SCOREBOARD_SCRUB_TIMER = 30
    PR_TUNABLE_SELECT_TIMEOUT = 30
    PR_TUNABLE_TIMEOUTIDENT = 10
    PR_TUNABLE_TIMEOUTIDLE = 600
    PR_TUNABLE_TIMEOUTLINGER = 30
    PR_TUNABLE_TIMEOUTLOGIN = 300
    PR_TUNABLE_TIMEOUTNOXFER = 300
    PR_TUNABLE_TIMEOUTSTALLED = 3600
    PR_TUNABLE_XFER_SCOREBOARD_UPDATES = 10



# proftpd -vv
ProFTPD Version: 1.3.5 (stable)
  Scoreboard Version: 01040003
  Built: Tue Oct 7 2014 10:29:51 CEST

Loaded modules:
  mod_sql_mysql/4.0.8
  mod_sql/4.3
  mod_lang/1.0
  mod_ctrls/0.9.5
  mod_auth_pam/1.2
  mod_ident/1.0
  mod_dso/0.5
  mod_facts/0.3
  mod_delay/0.7
  mod_site.c
  mod_log.c
  mod_ls.c
  mod_auth.c
  mod_auth_file/1.0
  mod_auth_unix.c
  mod_rlimit/1.0
  mod_xfer.c
  mod_core.c
```


----------



## SirDice (Oct 8, 2014)

*Re: proftpd 1.3.5 / mod_sql message: 'unknown named connetio*

What do the tables look like? Did you create them?


----------



## chrissie (Oct 8, 2014)

*Re: proftpd 1.3.5 / mod_sql message: 'unknown named connetio*

Yes, the tables were created, and i think, they are ok:


```
mysql> use froxlor;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> describe ftp_users;
+---------------+---------------+------+-----+---------------------+----------------+
| Field         | Type          | Null | Key | Default             | Extra          |
+---------------+---------------+------+-----+---------------------+----------------+
| id            | int(20)       | NO   | PRI | NULL                | auto_increment |
| username      | varchar(255)  | NO   | UNI |                     |                |
| uid           | int(5)        | NO   |     | 0                   |                |
| gid           | int(5)        | NO   |     | 0                   |                |
| password      | varchar(128)  | NO   |     |                     |                |
| homedir       | varchar(255)  | NO   |     |                     |                |
| shell         | varchar(255)  | NO   |     | /bin/false          |                |
| login_enabled | enum('N','Y') | NO   |     | N                   |                |
| login_count   | int(15)       | NO   |     | 0                   |                |
| last_login    | datetime      | NO   |     | 0000-00-00 00:00:00 |                |
| up_count      | int(15)       | NO   |     | 0                   |                |
| up_bytes      | bigint(30)    | NO   |     | 0                   |                |
| down_count    | int(15)       | NO   |     | 0                   |                |
| down_bytes    | bigint(30)    | NO   |     | 0                   |                |
| customerid    | int(11)       | NO   | MUL | 0                   |                |
+---------------+---------------+------+-----+---------------------+----------------+
15 rows in set (0.00 sec)

mysql> select * from ftp_users limit 1;
+----+----------+-------+-------+------------------------------------+----------------------------+------------+---------------+-------------+---------------------+----------+----------+------------+------------+------------+
| id | username | uid   | gid   | password                           | homedir                    | shell      | login_enabled | login_count | last_login          | up_count | up_bytes | down_count | down_bytes | customerid |
+----+----------+-------+-------+------------------------------------+----------------------------+------------+---------------+-------------+---------------------+----------+----------+------------+------------+------------+
|  1 | xxxx1    | 10000 | 10000 | $1$63xxxxed$o9QJl0W/1KkOxxxxxrTca1 | /var/customers/webs/xxxx1/ | /bin/false | Y             |           0 | 0000-00-00 00:00:00 |        0 |        0 |          0 |          0 |          1 |
+----+----------+-------+-------+------------------------------------+----------------------------+------------+---------------+-------------+---------------------+----------+----------+------------+------------+------------+
1 row in set (0.00 sec)
```


----------



## SirDice (Oct 8, 2014)

*Re: proftpd 1.3.5 / mod_sql message: 'unknown named connetio*

I've recently set this up on Ubuntu. Although the configuration files are in different locations the configuration itself should be the same. Have a look at their tables and the SQL queries they've added to the configuration. As far as I know those are needed to get things like quotas working. 

https://www.digitalocean.com/community/ ... untu-12-10


----------



## chrissie (Oct 8, 2014)

*Re: proftpd 1.3.5 / mod_sql message: 'unknown named connetio*

I know the queries about the quotas. They are there, but commented out at the moment. I don*'*t think this will make a difference regarding the 'unknown named connection" error, does it?

At the moment i am using AuthUserFile with the same Users as in the SQL Table, and it works. I can live with that at the moment, but still searching for a real solution.


----------

