ok i have tried to ftp to my server using filezilla and i get this Status: Connecting to myserver.com ... Status: Connected with myserver.com. Waiting for welcome message... Response: 220 FTP Server (Version 1.0) ready. Command: USER myusername Response: 331 User name okay, need password. Command: PASS ********** Response: 530 Not logged in. Error: Unable to connect! now i have tried this for every user on my system with the correct passwords and have set up new usernames to test this and still get this error. So i followed falko's howto for mysql and virtual users with proftpd but i still get the same errors returned from my ftp client. I have trawled the forum but i cant seem to find the right answer, any ideas?
Im using debian etch 4.0, now with proftpd in the proftpd log i have May 04 17:56:17 server1.example.com proftpd[3397] server1.example.com (192.168.1.3[192.168.1.3]): FTP session closed. i get the same log entry no matter which user i try and sign on with and all return the same log entry. i tried telnet locahost 21 and this was instantly kicked out, im not sure if it should have been or not as i have never telnet'd 21 before.
Contents of /etc/proftpd.conf below, Code: # # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file. # To really apply changes reload proftpd after modifications. # # Includes DSO modules Include /etc/proftpd/modules.conf # Set off to disable IPv6 support which is annoying on IPv4 only boxes. UseIPv6 off ServerName "Debian" ServerType standalone DeferWelcome off MultilineRFC2228 on DefaultServer on ShowSymlinks on TimeoutNoTransfer 600 TimeoutStalled 600 TimeoutIdle 1200 DisplayLogin welcome.msg DisplayFirstChdir .message ListOptions "-l" DenyFilter \*.*/ # Port 21 is the standard FTP port. Port 21 # In some cases you have to specify passive ports range to by-pass # firewall limitations. Ephemeral ports can be used for that, but # feel free to use a more narrow range. # PassivePorts 49152 65534 # To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 30 # Set the user and group that the server normally runs at. User proftpd Group nogroup # Umask 022 is a good standard umask to prevent new files and dirs # (second parm) from being group and world writable. Umask 022 022 # Normally, we want files to be overwriteable. AllowOverwrite on # Uncomment this if you are using NIS or LDAP to retrieve passwords: # PersistentPasswd off # Be warned: use of this directive impacts CPU average load! # # Uncomment this if you like to see progress and transfer rate with ftpwho # in downloads. That is not needed for uploads rates. # UseSendFile off TransferLog /var/log/proftpd/xferlog SystemLog /var/log/proftpd/proftpd.log <IfModule mod_tls.c> TLSEngine off </IfModule> <IfModule mod_quota.c> QuotaEngine on </IfModule> <IfModule mod_ratio.c> Ratios on </IfModule> # Delay engine reduces impact of the so-called Timing Attack described in # http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02 # It is on by default. <IfModule mod_delay.c> DelayEngine on </IfModule> <IfModule mod_ctrls.c> ControlsEngine on ControlsMaxClients 2 ControlsLog /var/log/proftpd/controls.log ControlsInterval 5 ControlsSocket /var/run/proftpd/proftpd.sock </IfModule> <IfModule mod_ctrls_admin.c> AdminControlsEngine on </IfModule> # A basic anonymous configuration, no upload directories. # <Anonymous ~ftp> # User ftp # Group nogroup # # We want clients to be able to login with "anonymous" as well as "ftp" # UserAlias anonymous ftp # # Cosmetic changes, all files belongs to ftp user # DirFakeUser on ftp # DirFakeGroup on ftp # # RequireValidShell off # # # Limit the maximum number of anonymous logins # MaxClients 10 # # # We want 'welcome.msg' displayed at login, and '.message' displayed # # in each newly chdired directory. # DisplayLogin welcome.msg # DisplayFirstChdir .message # # # Limit WRITE everywhere in the anonymous chroot # <Directory *> # <Limit WRITE> # DenyAll # </Limit> # </Directory> # # # Uncomment this if you're brave. # # <Directory incoming> # # # Umask 022 is a good standard umask to prevent new files and dirs # # # (second parm) from being group and world writable. # # Umask 022 022 # # <Limit READ WRITE> # # DenyAll # # </Limit> # # <Limit STOR> # # AllowAll # # </Limit> # # </Directory> # # </Anonymous> DefaultRoot ~ # The passwords in MySQL are encrypted using CRYPT SQLAuthTypes Plaintext Crypt SQLAuthenticate users* groups* # used to connect to the database # databasename@host database_user user_password SQLConnectInfo ftp@localhost proftpd mypassword # Here we tell ProFTPd the names of the database columns in the "usertable" # we want it to interact with. Match the names with those in the db SQLUserInfo ftpuser userid passwd uid gid homedir shell # Here we tell ProFTPd the names of the database columns in the "grouptable" # we want it to interact with. Again the names match with those in the db SQLGroupInfo ftpgroup groupname gid members # set min UID and GID - otherwise these are 999 each SQLMinID 500 # create a user's home directory on demand if it doesn't exist SQLHomedirOnDemand on # Update count every time user logs in SQLLog PASS updatecount SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u '" ftpuser # Update modified everytime user uploads or deletes a file SQLLog STOR,DELE modified SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser # User quotas # =========== QuotaEngine on QuotaDirectoryTally on QuotaDisplayUnits Mb QuotaShowQuotas on SQLNamedQuery get-quota-limit SELECT "name, quota_type, per_session, limit_type, bytes_in_avail, bytes_out_avail, bytes_xfer_avail, files_in_avail, files_out_av ail, files_xfer_avail FROM ftpquotalimits WHERE name = '%{0}' AND quota_type = ' %{1}'" SQLNamedQuery get-quota-tally SELECT "name, quota_type, bytes_in_used, bytes_out _used, bytes_xfer_used, files_in_used, files_out_used, files_xfer_used FROM ftpq uotatallies WHERE name = '%{0}' AND quota_type = '%{1}'" SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, b ytes_out_used = bytes_out_used + %{1}, bytes_xfer_used = bytes_xfer_used + %{2}, files_in_used = files_in_used + %{3}, files_out_used = files_out_used + %{4}, f iles_xfer_used = files_xfer_used + %{5} WHERE name = '%{6}' AND quota_type = '%{ 7}'" ftpquotatallies SQLNamedQuery insert-quota-tally INSERT "%{0}, %{1}, %{2}, %{3}, %{4}, %{5}, %{6 }, %{7}" ftpquotatallies QuotaLimitTable sql:/get-quota-limit QuotaTallyTable sql:/get-quota-tally/update-quota-tally/insert-quota-tally RootLogin off RequireValidShell off
Are the users, passwords, etc. in this part correct? Code: # The passwords in MySQL are encrypted using CRYPT SQLAuthTypes Plaintext Crypt SQLAuthenticate users* groups* # used to connect to the database # databasename@host database_user user_password SQLConnectInfo ftp@localhost proftpd mypassword # Here we tell ProFTPd the names of the database columns in the "usertable" # we want it to interact with. Match the names with those in the db SQLUserInfo ftpuser userid passwd uid gid homedir shell # Here we tell ProFTPd the names of the database columns in the "grouptable" # we want it to interact with. Again the names match with those in the db SQLGroupInfo ftpgroup groupname gid members
Yep the above is correct, i have checked it out in phpmyadmin i have only created 1 user in the database. i have rebooted the server just to check, the user seems to be recognised but not the password, could this be an encryption difference? the passwords are plain text in the database would this be an issue?
Can you change Code: SQLAuthTypes Plaintext Crypt to Code: SQLAuthTypes Plaintext ? If that doesn't work, what's the output of Code: ls -l /etc/pam.d ?
Hope this helps Falko Code: server1:~# ls -l /etc/pam.d total 100 -rw-r--r-- 1 root root 182 2006-01-03 07:15 atd -rw-r--r-- 1 root root 384 2007-02-27 07:27 chfn -rw-r--r-- 1 root root 581 2007-02-27 07:27 chsh -rw-r--r-- 1 root root 392 2008-04-26 10:39 common-account -rw-r--r-- 1 root root 436 2008-04-26 10:39 common-auth -rw-r--r-- 1 root root 1097 2008-04-26 10:39 common-password -rw-r--r-- 1 root root 372 2008-04-26 10:39 common-session -rw-r--r-- 1 root root 289 2005-10-14 13:00 cron -rw-r--r-- 1 root root 69 2008-03-23 04:28 cupsys -rw-r--r-- 1 root root 101 2008-05-03 11:57 ftp -rw-r--r-- 1 root root 0 2008-05-03 11:55 ftp~ -rw-r--r-- 1 root root 263 2006-12-15 08:16 gdm -rw-r--r-- 1 root root 270 2006-12-16 11:24 gdm-autologin -rw-r--r-- 1 root root 21 2006-11-24 20:43 gnome-screensaver -rw-r--r-- 1 root root 148 2007-02-13 09:51 imap -rw-r--r-- 1 root root 2843 2007-02-27 07:27 login -rw-r--r-- 1 root root 38 2007-03-07 22:30 newrole -rw-r--r-- 1 root root 520 2003-08-31 23:21 other -rw-r--r-- 1 root root 92 2007-02-27 07:27 passwd -rw-r--r-- 1 root root 148 2007-02-13 09:51 pop3 -rw-r--r-- 1 root root 370 2007-01-02 10:00 proftpd -rw-r--r-- 1 root root 38 2007-03-07 22:30 run_init -rw-r--r-- 1 root root 290 2008-04-26 14:28 smtp -rw-r--r-- 1 root root 0 2008-04-26 14:27 smtp~ -rw-r--r-- 1 root root 1272 2007-03-05 16:36 ssh -rw-r--r-- 1 root root 2305 2007-02-27 07:27 su -rw-r--r-- 1 root root 56 2006-04-15 08:39 sudo server1:~#
I tried changing the crypt for sqlauth and it had no effect, i have tried allsorts of weird user names that i know are NOT in the ftp database, but i still get user ok, need password so that may have been a red herring. Code: server1:~# cat /etc/pam.d/proftpd #%PAM-1.0 auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed @include common-auth # This is disabled because anonymous logins will fail otherwise, # unless you give the 'ftp' user a valid shell, or /bin/false and add # /bin/false to /etc/shells. #auth required pam_shells.so @include common-account @include common-session Code: server1:~# cat /etc/pam.d/ftp #%PAM-1.0 auth required pam_unix.so nullok account required pam_unix.so session required pam_unix.so server1:~#
any ideas falko? i can pm you my server name and account for you to try. it may possibly be because im inside my network, i don't know.
Hi, I'm having similar problems with my virtual proftpd setup trying to authenticate with mod_sql.c and mysql. The database users are all configured correctly, I can log in successfully using "mysql -u user -p" using the credentials (not what's shown below obviously). I can't even get SQLLogFile to work, there's no output. I'm logging all queries to mysql and there is no attempt being made to login by proftd, much less any queries being generated. I've setup unix users and groups for the virtual users (ftpuser) and groups (ftpgroup) on uid 3001 and gid 3001 respectively. The databases are populated correctly (I think!), not that they're getting hit. The following is the contents of /etc/proftpd/mysql.conf, which is include by my main proftd.conf file, shown below: Code: SQLEngine on SQLBackend mysql SQLAuthTypes Plaintext #SQLAuthenticate on (I replaced this with AuthOrder because of a deprication warning) AuthOrder mod_sql.c SQLConnectInfo ftp@localhost user password SQLUserInfo ftpuser userid passwd uid gid homedir shell SQLGroupInfo ftpgroup groupname gid members #SQLHomedirOnDemand on (again, replaced with CreateHome because of a deprecation warning) CreateHome on # update counter when a user logs in SQLLog PASS updatecount SQLNamedQuery updatecount UPDATE "count=count+1, accessed=now() WHERE userid='%u'" ftpuser # change modified time anytime a user delete a file or upload one SQLLog STOR,DELE modified SQLNamedQuery modified UPDATE "modified=now() WHERE userid='%u'" ftpuser Code: # # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file. # To really apply changes reload proftpd after modifications. # # Includes DSO modules Include /etc/proftpd/modules.conf # Set off to disable IPv6 support which is annoying on IPv4 only boxes. UseIPv6 on ServerName "FTP Server" ServerType standalone DeferWelcome on MultilineRFC2228 on DefaultServer on ShowSymlinks on TimeoutNoTransfer 600 TimeoutStalled 600 TimeoutIdle 1200 DisplayLogin welcome.msg DisplayChdir .message true ListOptions "-l" #DenyFilter \*.*/ # Use this to jail all users in their homes DefaultRoot ~ # Users require a valid shell listed in /etc/shells to login. # Use this directive to release that constrain. # RequireValidShell off # Port 21 is the standard FTP port. Port 21 # In some cases you have to specify passive ports range to by-pass # firewall limitations. Ephemeral ports can be used for that, but # feel free to use a more narrow range. #PassivePorts 49152 65534 # If your host was NATted, this option is useful in order to # allow passive tranfers to work. You have to use your public # address and opening the passive ports used on your firewall as well. # MasqueradeAddress 1.2.3.4 # To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 30 # Set the user and group that the server normally runs at. User proftpd Group proftpd # Umask 022 is a good standard umask to prevent new files and dirs # (second parm) from being group and world writable. Umask 022 022 # Normally, we want files to be overwriteable. AllowOverwrite on # Uncomment this if you are using NIS or LDAP via NSS to retrieve passwords: # PersistentPasswd off # This is required to use both PAM-based authentication and local passwords # AuthOrder *mod_auth_pam.c mod_auth_unix.c # Be warned: use of this directive impacts CPU average load! # Uncomment this if you like to see progress and transfer rate with ftpwho # in downloads. That is not needed for uploads rates. # # UseSendFile off # Choose a SQL backend among MySQL or PostgreSQL. # Both modules are loaded in default configuration, so you have to specify the backend # or comment out the unused module in /etc/proftpd/modules.conf. # Use 'mysql' or 'postgres' as possible values. # <IfModule mod_sql.c> SQLBackend mysql </IfModule> Include /etc/proftpd/mysql.conf RootLogin off RequireValidShell off SQLLogFile /var/log/proftpd/mod_sql.log TransferLog /var/log/proftpd/xferlog SystemLog /var/log/proftpd/proftpd.log <IfModule mod_quotatab.c> QuotaEngine off </IfModule> <IfModule mod_ratio.c> Ratios off </IfModule> # Delay engine reduces impact of the so-called Timing Attack described in # http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02 # It is on by default. <IfModule mod_delay.c> DelayEngine on </IfModule> <IfModule mod_ctrls.c> ControlsEngine off ControlsMaxClients 2 ControlsLog /var/log/proftpd/controls.log ControlsInterval 5 ControlsSocket /var/run/proftpd/proftpd.sock </IfModule> <IfModule mod_ctrls_admin.c> AdminControlsEngine off </IfModule> # # Alternative authentication frameworks # #Include /etc/proftpd/ldap.conf #Include /etc/proftpd/sql.conf # # This is used for FTPS connections # #Include /etc/proftpd/tls.conf # A basic anonymous configuration, no upload directories. # <Anonymous ~ftp> # User ftp # Group nogroup # # We want clients to be able to login with "anonymous" as well as "ftp" # UserAlias anonymous ftp # # Cosmetic changes, all files belongs to ftp user # DirFakeUser on ftp # DirFakeGroup on ftp # # RequireValidShell off # # # Limit the maximum number of anonymous logins # MaxClients 10 # # # We want 'welcome.msg' displayed at login, and '.message' displayed # # in each newly chdired directory. # DisplayLogin welcome.msg # DisplayFirstChdir .message # # # Limit WRITE everywhere in the anonymous chroot # <Directory *> # <Limit WRITE> # DenyAll # </Limit> # </Directory> # # # Uncomment this if you're brave. # # <Directory incoming> # # # Umask 022 is a good standard umask to prevent new files and dirs # # # (second parm) from being group and world writable. # # Umask 022 022 # # <Limit READ WRITE> # # DenyAll # # </Limit> # # <Limit STOR> # # AllowAll # # </Limit> # # </Directory> # # </Anonymous> <VirtualHost www.mydomain.com> ServerName "My FTP Server" MaxClients 10 MaxLoginAttempts 3 DeferWelcome on <Limit LOGIN> Allow All </Limit> </VirtualHost> Any pointers would be much appreciated, this is driving me out of my mind!
Hi, The only real output in my proftpd.log file is as follows: Code: Jun 06 10:45:48 server1 proftpd[29070] xxx.xxx.xxx.xxx: FTP session opened. Jun 06 10:45:49 server1 proftpd[29070] xxx.xxx.xxx.xxx: no such user 'test' found from xxx.xxx.xxx.xxx [::ffff:xxx.xxx.xxx.xxx] to ::ffff:xxx.xxx.xxx.xxx:21 Jun 06 10:45:49 server1 proftpd[29070] xxx.xxx.xxx.xxx:USER test: no such user $ Jun 06 10:45:49 server1 proftpd[29070] xxx.xxx.xxx.xxx: FTP session closed. The /var/log/proftpd/mod_sql.log never gets created, which leads me to suspect that for some (probably stupid mistake related) reason proftpd is not using it for any purpose but I think I'm doing the right sort of things. modules.conf looks like this: Code: # # This file is used to manage DSO modules and features. # # This is the directory where DSO modules reside ModulePath /usr/lib/proftpd # Allow only user root to load and unload modules, but allow everyone # to see which modules have been loaded ModuleControlsACLs insmod,rmmod allow user root ModuleControlsACLs lsmod allow user * LoadModule mod_ctrls_admin.c LoadModule mod_tls.c LoadModule mod_sql.c LoadModule mod_ldap.c # # 'SQLBackend mysql' or 'SQLBackend postgres' directives are required # to have SQL authorization working. You can also comment out the # unused module here, in alternative. # LoadModule mod_sql_mysql.c #LoadModule mod_sql_postgres.c LoadModule mod_radius.c LoadModule mod_quotatab.c LoadModule mod_quotatab_file.c LoadModule mod_quotatab_ldap.c LoadModule mod_quotatab_sql.c LoadModule mod_quotatab_radius.c LoadModule mod_wrap.c LoadModule mod_rewrite.c LoadModule mod_load.c LoadModule mod_ban.c LoadModule mod_wrap2.c LoadModule mod_wrap2_file.c LoadModule mod_wrap2_sql.c # keep this module the last one LoadModule mod_ifsession.c I commented out mod_sql_postres.c because I'd read somewhere that it causes problems on Ubuntu (I'm running on 8.04 LTS). my modules path looks like this: Code: mod_ban.a mod_ifsession.la mod_quotatab_file.la mod_quotatab_sql.a mod_rewrite.la mod_sql_postgres.a mod_wrap2_file.so mod_ban.la mod_ifsession.so mod_quotatab_file.so mod_quotatab_sql.la mod_rewrite.so mod_sql_postgres.la mod_wrap2.la mod_ban.so mod_ldap.a mod_quotatab.la mod_quotatab_sql.so mod_site_misc.a mod_sql_postgres.so mod_wrap2.so mod_ctrls_admin.a mod_ldap.la mod_quotatab_ldap.a mod_radius.a mod_site_misc.la mod_sql.so mod_wrap2_sql.a mod_ctrls_admin.la mod_ldap.so mod_quotatab_ldap.la mod_radius.la mod_site_misc.so mod_tls.a mod_wrap2_sql.la mod_ctrls_admin.so mod_load.a mod_quotatab_ldap.so mod_radius.so mod_sql.a mod_tls.la mod_wrap2_sql.so mod_facl.a mod_load.la mod_quotatab_radius.a mod_ratio.a mod_sql.la mod_tls.so mod_wrap.a mod_facl.la mod_load.so mod_quotatab_radius.la mod_ratio.la mod_sql_mysql.a mod_wrap2.a mod_wrap.la mod_facl.so mod_quotatab.a mod_quotatab_radius.so mod_ratio.so mod_sql_mysql.la mod_wrap2_file.a mod_wrap.so mod_ifsession.a mod_quotatab_file.a mod_quotatab.so mod_rewrite.a mod_sql_mysql.so mod_wrap2_file.la Thanks for your help! Chris...
Then I don't know what's causing the problem. Maybe I'll try to set this up on Ubuntu 8.04 in the next days to see if I have the same problem.