2

I have a piece of a Java program that access the local FTP server (running on VSFTPD) which I use to upload and download files. I am planning this application to be remote-capable so that it can access a remote computer for file transfer. The following is what I have done so far.

  1. Installed VSFTPD using sudo apt-get install vsftpd (I am running on Ubuntu 16.04 LTS).
  2. Added the configurations which looks like following. (I have taken out the comments to reduce the content)

    listen=NO
    listen_ipv6=YES
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    #local_umask=022
    #anon_upload_enable=YES
    #anon_mkdir_write_enable=YES
    dirmessage_enable=YES
    use_localtime=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    #chown_uploads=YES
    #chown_username=whoever
    #xferlog_file=/var/log/vsftpd.log
    #xferlog_std_format=YES
    #idle_session_timeout=600
    #data_connection_timeout=120
    #nopriv_user=ftpsecure
    #async_abor_enable=YES
    #ascii_upload_enable=YES
    #ascii_download_enable=YES
    #ftpd_banner=Welcome to blah FTP service.
    #deny_email_enable=YES
    #banned_email_file=/etc/vsftpd.banned_emails
    #chroot_local_user=YES
    #chroot_local_user=YES
    #chroot_list_enable=YES
    #chroot_list_file=/etc/vsftpd.chroot_list
    #ls_recurse_enable=YES
    secure_chroot_dir=/var/run/vsftpd/empty
    pam_service_name=vsftpd
    # encrypted connections.
    rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    ssl_enable=NO
    #utf8_filesystem=YES
    local_root=/var/ftp/local_root
    
  3. Created a separate user named ftpuser and changed that user's home directory to /var/ftp/local_root.

  4. Added the user to /etc/vsftpd.chroot_list.

The daemon is up and running and when I run the java snippet with the credentials of my currently logged-in account the file upload works damn smoothly. And the file is being uploaded to the current users home directory. (which is what it should be, with the current setting)

Now what I need to do is, run this snippet in the current user that I am logged in and log-into the FTP server as the ftpuser, which is a user account available in the system but not currently logged in. TO do this, I have changed the snippets in the code snippet to ftpuser and <password> and I get an error 530 Please login with USER and PASS.

What am I doing wrong? Have I messed up the configuration? Or is what I try to achieve even possible?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.