vsftpd cannot connect

Discussion in 'Server Operation' started by Alan Cameron, Aug 12, 2019.

  1. Alan Cameron

    Alan Cameron New Member

    I have been following the tutorial Install and Configure VSFTPD server on Ubuntu 18.04 LTS but cannot connect when I get to the step of using my browser to connect using ftp://IP address. The response I get is Cannot reach this page. I have an SSH connection for both root and my UserName which can reach the website. I can ping the website so I conclude that vsftpd although showing started is in someway misconfigured.
    I did get an error code 2 INVALID ARGUMENT on my first attempt but I corrected the faulty argument in the vsftpd.conf.
    How can I find out what is stopping vsftpd from responding?
     
  2. Prahlad Makwana

    Prahlad Makwana New Member

    Hello, @Alan Cameron
    Please try to reconnect VSFTPD using following steps.

    Installing VSFTPD
    Step 1 :- Login to the server via SSH
    ssh [email protected]

    Step 2 :- Change into the root user
    sudo su

    Step 3 :- Install VSFTPD
    apt-get install vsftpd -y

    Step 4 :- Start VSFTPD and set it to start on boot
    systemctl start vsftpd
    systemctl enable vsftpd

    Step 5 :- Create a user for FTP access
    adduser vsftp

    Step 6 :- Make an FTP directory and set permissions
    mkdir /home/vsftp/ftp
    chown nobody:nogroup /home/vsftp/ftp
    chmod a-w /home/vsftp/ftp

    Step 7 :- Create an upload directory and set permissions
    mkdir /home/vsftp/ftp/test
    chown vsftp:vsftp /home/vsftp/ftp/test

    Configuring VSFTPD
    Step 1 :- Backup the configuration file
    cp /etc/vsftpd.conf /etc/vsftpd.conf.bak

    Step 2 :- Open the configuration file in your favourite text editor
    vi /etc/vsftpd.conf

    Step 3 :- Add the following lines to the file,then save and close the file:
    listen=NO
    listen_ipv6=YES
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    local_umask=022
    dirmessage_enable=YES
    use_localtime=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    chroot_local_user=YES
    secure_chroot_dir=/var/run/vsftpd/empty
    pam_service_name=vsftpd
    pasv_enable=Yes
    pasv_min_port=10000
    pasv_max_port=11000
    user_sub_token=$USER
    local_root=/home/$USER/ftp
    userlist_enable=YES
    userlist_file=/etc/vsftpd.userlist
    userlist_deny=NO
    rsa_cert_file=/etc/cert/vsftpd.pem
    rsa_private_key_file=/etc/cert/vsftpd.pem
    ssl_enable=YES
    allow_anon_ssl=NO
    force_local_data_ssl=YES
    force_local_logins_ssl=YES
    ssl_tlsv1=YES
    ssl_sslv2=NO
    ssl_sslv3=NO
    require_ssl_reuse=NO
    ssl_ciphers=HIGH

    Step 4 :- Add the FTP user to VSFTP
    vi /etc/vsftpd.userlist

    Step 5 :- Create a certificate to connect via SSL
    mkdir /etc/cert
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/cert/vsftpd.pem -out /etc/cert/vsftpd.pem

    Step 6 :- Restart VSFTP
    systemctl restart vsftpd

    Step 7:- Connect to the FTP server and visit ftp://YOUR-SERVER-IP

    I hope above information will be useful for you.
    Thank you.
     

Share This Page