proFTPd with MySQL support, cannot change directory ('CWD' command)

Discussion in 'Server Operation' started by tode, Oct 8, 2019 at 6:57 PM.

  1. tode

    tode New Member

    Hi,
    I followed the tutorial “Virtual Hosting With Proftpd And MySQL (Incl. Quota) On Fedora 9” (https://www.howtoforge.com/virtual-hosting-with-proftpd-and-mysql-fedora9) to install proFTPd on Red Hat Enterprise Linux Server 7.7 (no ISPConfig).

    I added the repo “Extra Packages for Enterprise Linux (EPEL)” to retrieve the proftpd-mysql package.

    I can login, upload and download files, create directories but I can't change current directory.

    This is a ncftp session from a remote machine:

    Code:
    $ ncftp -u test aaa.bbb.ccc.ddd
    [...]    
    ncftp / > dir
    ncftp / > put /tmp/file.txt
    /tmp/file.txt:                                          15,00 B  552,98 B/s   
    ncftp / > dir
    -rw-r--r--   2001     2001           15   ott  7 16:36   file.txt
    ncftp / > mkdir mydir
    ncftp / > cd mydir
    Could not chdir to mydir: server said: mydir: File o directory non esistente
    ncftp / > dir
    -rw-r--r--   2001     2001           15   ott  7 16:36   file.txt
    drwxr-xr-x   2001     2001                ott  8 18:25   mydir
    ncftp / > 
    This is proFTPd version:

    Code:
    Compile-time Settings:
    Version: 1.3.5e (maint)
    Platform: LINUX [Linux 3.10.0-1062.1.2.el7.x86_64 x86_64]
    [...]
    This is “/etc/proftpd.conf” configuration file:

    Code:
    [...]
    # Use pam to authenticate (default) and be authoritative
    #AuthPAMConfig proftpd
    #AuthOrder mod_auth_pam.c* mod_auth_unix.c
    [...]
    # Set the user and group that the server runs as
    User nobody
    Group nobody
    [...]
    <Global>
    
    # Umask 022 is a good standard umask to prevent new dirs and files
    # from being group and world writable
    Umask 022
    
    # Allow users to overwrite files and change permissions
    AllowOverwrite yes
    <Limit ALL SITE_CHMOD>
    AllowAll
    </Limit>
    
    </Global>
    [...]
    # From HowtoForge tutorial
    #
    LoadModule mod_sql.c
    LoadModule mod_sql_mysql.c
    LoadModule mod_quotatab.c
    LoadModule mod_quotatab_sql.c
    
    SQLAuthTypes OpenSSL
    SQLAuthenticate users groups
    
    # used to connect to the database
    # [email protected] database_user user_password
    SQLConnectInfo [email protected] proftpd XXXXXXXXXXXXXXXXXX
    
    # 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
    CreateHome 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_avail, 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 ftpquotatallies WHERE name = '%{0}' AND quota_type = '%{1}'"
    
    SQLNamedQuery update-quota-tally UPDATE "bytes_in_used = bytes_in_used + %{0}, bytes_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}, files_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
    
    # Enable PASV mode
    PassivePorts 60000 65535
    AllowStoreRestart on
    AllowRetrieveRestart on
    TimeoutNoTransfer 65535
    ListOptions "-la"
    TimeoutIdle 65535
    This is the proFTPd log when I try to change current directory:

    Code:
    2019-10-08 16:47:00,364 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'HELP SITE' to mod_tls
    2019-10-08 16:47:00,364 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'HELP SITE' to mod_core
    2019-10-08 16:47:00,364 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'HELP SITE' to mod_core
    2019-10-08 16:47:00,364 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching CMD command 'HELP SITE' to mod_core
    2019-10-08 16:47:00,364 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching POST_CMD command 'HELP SITE' to mod_sql
    2019-10-08 16:47:00,365 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD command 'HELP SITE' to mod_sql
    2019-10-08 16:47:00,365 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD command 'HELP SITE' to mod_log
    2019-10-08 16:47:00,386 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CLNT NcFTP 3.2.5 linux-x86_64-glibc2.23' to mod_tls
    2019-10-08 16:47:00,386 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CLNT NcFTP 3.2.5 linux-x86_64-glibc2.23' to mod_core
    2019-10-08 16:47:00,386 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CLNT NcFTP 3.2.5 linux-x86_64-glibc2.23' to mod_core
    2019-10-08 16:47:00,386 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching POST_CMD_ERR command 'CLNT NcFTP 3.2.5 linux-x86_64-glibc2.23' to mod_sql
    2019-10-08 16:47:00,386 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD_ERR command 'CLNT NcFTP 3.2.5 linux-x86_64-glibc2.23' to mod_sql
    2019-10-08 16:47:00,386 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD_ERR command 'CLNT NcFTP 3.2.5 linux-x86_64-glibc2.23' to mod_log
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CWD aaaa' to mod_tls
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CWD aaaa' to mod_core
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CWD aaaa' to mod_core
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching CMD command 'CWD aaaa' to mod_core
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching POST_CMD_ERR command 'CWD aaaa' to mod_sql
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD_ERR command 'CWD aaaa' to mod_sql
    2019-10-08 16:47:13,402 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD_ERR command 'CWD aaaa' to mod_log
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CWD aaaa' to mod_tls
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CWD aaaa' to mod_core
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching PRE_CMD command 'CWD aaaa' to mod_core
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching CMD command 'CWD aaaa' to mod_core
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching POST_CMD_ERR command 'CWD aaaa' to mod_sql
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD_ERR command 'CWD aaaa' to mod_sql
    2019-10-08 16:47:13,422 hostname.domain.tld proftpd[65985] 127.0.0.1 (AAA.BBB.CCC.DDD[AAA.BBB.CCC.DDD]): dispatching LOG_CMD_ERR command 'CWD aaaa' to mod_log

    I tried to disable SELinux without success, problem on CWD command persist.

    If I use a local user (not in MySQL DB) I can change the current directory without problems…

    This is driving me crazy,
    please help,
    thanks,
    tode
     

Share This Page