FedoraForum.org - Fedora Support Forums and Community
Results 1 to 9 of 9
  1. #1
    Join Date
    May 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Vsftpd virtual users problem

    Hi everyone!

    I'm trying to setup an Ftp server with virtual users using vsftp
    My vsftpd.conf is

    Code:
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    local_umask=022
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    nopriv_user=vsftpd
    chroot_local_user=YES
    secure_chroot_dir=/var/run/vsftpd
    pam_service_name=vsftpd
    rsa_cert_file=/etc/ssl/certs/vsftpd.pem
    guest_enable=YES
    guest_username=vsftpd
    local_root=/home/vsftpd/$USER
    user_sub_token=$USER
    virtual_use_local_privs=YES
    user_config_dir=/etc/vsftpd_user_conf
    My pam configuration is

    Code:
    auth required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
    account required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
    I keep getting an error 530 cannot login
    I've searched the forum and google but i didn't find any solution

    The problem must be in the pam configuration

    Can anyone help???

    Thanks in advance!

  2. #2
    Join Date
    Jun 2008
    Posts
    716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Should be problem with crypt=2.

    Code:
    2 (or "mysql") = Use MySQL PASSWORD() function. It is possible
                            that the encryption function used by PAM-MySQL
                            is different from that of the MySQL server, as
                            PAM-MySQL uses the function defined in MySQL's
                            C-client API instead of using PASSWORD() SQL function
                            in the query.
    I have no problem with crypt=0 or crypt=1 (md5=true). You may have to increase size of 'pass' column for md5 crypt.

    Also check /var/log/secure for pam errors.

  3. #3
    Join Date
    May 2007
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried with crypt=0 and still nothing works!
    Now i get an error Can't read from control socket. Socket error = #10054
    Syntax error: command unrecognized.

  4. #4
    Join Date
    Jun 2008
    Posts
    716
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    With crypt=0, I updated password column (your 'pass' column) with plain text password.

    With crypt=1 md5=true, you can test by copy/paste password from /etc/shadow. I used password generated by
    crypt("mypasswd","$1$SALT$").

    Not sure what your socket error is.

  5. #5
    Join Date
    Nov 2006
    Location
    U.S.A.
    Age
    41
    Posts
    473
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm looking to set up virtual users as well, for Joomla 1.5, I have vsftpd as well. Can anyone point me to an idiot's guide for setting up virtual users?
    Last edited by neogranas; 6th October 2008 at 05:19 PM.
    Registered linux user: #475337

    Never underestimate someone with source code, a text editor, and the willingness to completely hose their system.

  6. #6
    OttoneDegliUliv Guest
    Quote Originally Posted by lamousis
    ...
    My pam configuration is

    Code:
    auth required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
    account required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass crypt=2
    I keep getting an error 530 cannot login
    I've searched the forum and google but i didn't find any solution

    The problem must be in the pam configuration
    <<Prior to MySQL 4.1, password hashes computed by the PASSWORD() function are 16 bytes long. In MySQL 4.1 and advance, the PASSWORD() function has been modified to produce a longer 41-byte hash value>>

    If you use the mysql "OLD_PASSWORD()" style (coded at 16 byte) you must use the
    "use_323_passwd" flag !

    Code:
    auth required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass use_323_passwd=1 crypt=2
    account required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass use_323_passwd=1  crypt=2

  7. #7
    Join Date
    Mar 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Vsftpd virtual users problem

    Code:
    auth required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass use_323_passwd=1 crypt=2
    account required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass use_323_passwd=1  crypt=2
    anyway..
    530. login incorrect.

    deciding that problem with full day already

    from start:

    rpm -qa | grep mysql
    Code:
    mysql-embedded-5.1.44-1.fc12.x86_64
    mysql-5.1.44-1.fc12.x86_64
    pam_mysql-0.7-0.9.rc1.fc12.2.i686
    mysql-libs-5.1.44-1.fc12.i686
    qt-mysql-4.6.2-8.fc12.x86_64
    php-mysql-5.3.1-1.fc12.x86_64
    mysql-server-5.1.44-1.fc12.x86_64
    pam_mysql-0.7-0.9.rc1.fc12.2.x86_64
    mysql-libs-5.1.44-1.fc12.x86_64
    mysqladmin -u root password secret

    mysql -u root -p

    Code:
    CREATE DATABASE vsftpd;
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON vsftpd.* TO 'vsftpd'@'localhost' IDENTIFIED BY 'ftpdpass';
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON vsftpd.* TO 'vsftpd'@'localhost.localdomain' IDENTIFIED BY 'ftpdpass';
    FLUSH PRIVILEGES;
    Code:
    USE vsftpd;
    CREATE TABLE `accounts` (
    `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `username` VARCHAR( 30 ) NOT NULL ,
    `pass` VARCHAR( 50 ) NOT NULL ,
    UNIQUE (
    `username`
    )
    ) ENGINE = MYISAM ;
    quit;
    useradd --home /home/vsftpd --gid nobody -m --shell /bin/false vsftpd

    cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.orig
    cat /dev/null > /etc/vsftpd/vsftpd.conf

    /etc/vsftpd/vsftpd.conf
    Code:
    listen=YES
    background=YES
    dirmessage_enable=YES
    syslog_enable=YES
    anon_mkdir_write_enable=YES
    idle_session_timeout=900
    log_ftp_protocol=YES
    max_clients=500
    max_per_ip=80
    pasv_enable=YES
    local_umask=022
    anonymous_enable=YES
    local_enable=YES
    write_enable=YES
    anon_upload_enable=yes
    pasv_min_port=49152
    pasv_max_port=65534
    xferlog_enable=YES
    nopriv_user=vsftpd
    chroot_local_user=YES
    #ftpd_banner=
    secure_chroot_dir=/var/run/vsftpd
    pam_service_name=vsftpd
    rsa_cert_file=/etc/ssl/certs/vsftpd.pem
    guest_enable=YES
    guest_username=vsftpd
    local_root=/home/vsftpd/$USER
    user_sub_token=$USER
    virtual_use_local_privs=YES
    user_config_dir=/etc/vsftpd_user_conf
    setproctitle_enable=YES
    session_support=YES
    cp /etc/pam.d/vsftpd /etc/pam.d/vsftpd_orig
    cat /dev/null > /etc/pam.d/vsftpd

    /etc/pam.d/vsftpd
    Code:
    auth required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass use_323_passwd=1 crypt=2
    account required pam_mysql.so user=vsftpd passwd=ftpdpass host=localhost db=vsftpd table=accounts usercolumn=username passwdcolumn=pass use_323_passwd=1  crypt=2
    /etc/init.d/vsftpd restart

    mysql -u root -p
    Code:
    USE vsftpd;
    INSERT INTO accounts (username, pass) VALUES('testuser', PASSWORD('secret')); quit;
    mkdir /var/run/vsftpd
    mkdir /home/vsftpd/testuser
    chown vsftpd:nobody /home/vsftpd/testuser

    Code:
    lftp ftp://myhost.dyndns.ws
    lftp myhost.dyndns.ws:~> ls                            
    drwxrws-wt    2 500      100          4096 Mar 25 17:16 incoming
    drwxrwsr-x    2 0        100          4096 Jan 14 14:08 pub
    ok

    Code:
    lftp ftp://testuser@myhost.dyndns.ws
    Password: 
    lftp testuser@myhost.dyndns.ws:~> ls                   
    ls: Login failed: 530 Login incorrect.
    it's unbearable)) The way that I wrote here is normally working under ArchLinux x86_64.
    Last edited by veranyon; 26th March 2010 at 01:15 AM.

  8. #8
    Join Date
    Jul 2010
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Re: Vsftpd virtual users problem

    Hi,

    This might be too late, I encountered the same problem too.

    There are several solutions to solve this problem:
    1. Use crypt=3 in /etc/pam.d/vsftpd to use MD5 as the password encryption
    2. If you still insist to use MySQL PASSWORD (crypt=2), please follow these steps:
    - Open your MySQL configuration file. By default it is : /etc/my.cnf
    - Remove this line :
    old_passwords=1
    - Restart mysqld service
    - Try to login to your FTP server again.

    I have tried in my configuration and now I can choose to encrypt the password using either MYSQL PASSWORD or MD5.

    Package reference:
    - mysql-5.0.77-4.el5_5.3
    - pam_mysql-0.7-0.5.rc1.el5.kb.2
    - vsftpd-2.0.5-16.el5_5.1

    For further troubleshooting, you can turn on the mysql logging in my.cnf and pam_mysql logging. This logfile helps me a lot in troubleshooting.

    Another recommendation for virtual FTP solution, you can use PureFTPd with quota and bandwidth management, which I prefer this. Here is the link

    Cheers~
    Last edited by hsuantio; 16th July 2010 at 02:54 AM.

  9. #9
    Join Date
    Mar 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Vsftpd virtual users problem


Similar Threads

  1. Fedora 9, vsftpd and virtual users.
    By Felarin in forum Servers & Networking
    Replies: 3
    Last Post: 3rd June 2008, 05:32 AM
  2. Vsftpd - Virtual Users
    By DanielGE in forum Servers & Networking
    Replies: 3
    Last Post: 5th February 2007, 10:02 PM
  3. vsftpd virtual users in FC5 -w-db3
    By jhp1 in forum Servers & Networking
    Replies: 0
    Last Post: 18th April 2006, 02:37 AM
  4. VSFTPD User permissions and Virtual Users
    By RJDavison in forum Servers & Networking
    Replies: 0
    Last Post: 24th January 2006, 03:07 PM
  5. vsftpd virtual&local users
    By sstone in forum Servers & Networking
    Replies: 2
    Last Post: 2nd March 2005, 09:48 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •