0

I am using nginx as my web server and vsftpd for FTP access. I have all set up and a test site running which is accessible from the outside world. Also have an API backend that is also serving fine.

Note: I have removed some sensitive info like domains and IPs where applicable.

I can connect to the FTP server via FTP/FileZilla, browse, create folders and also files via FTP. I however am getting an error in the vsftpd log which is below. This happens when a tool on another machine auto uploads to the folder via FTP connection which I dont have much control over.

Tue Feb 18 10:20:09 2020 [pid 2536] [FTP_USER_ID] FAIL MKDIR: Client "::ffff:88.215.0.185", "/dev.test.com/folder1/folder2/folder3"

I de believe my permissions to be correct but Ill list them out here and hopefully someone can spot my mistake.

Setting the Users $HOME to /var/www

Command: getent passwd FTP_USER_ID
Result FTP_USER_ID :x:1001:1001:,,,:/var/www:/bin/bash

Read set permissions for FTP user Command: ls -l /var/www

total 8
drwxr-xr-x 15 FTP_USER_ID FTP_USER_ID 4096 Feb 17 22:48 dev.example.com
drwxr-xr-x  2 FTP_USER_ID FTP_USER_ID 4096 Feb 17 01:51 html

vsftpd.conf

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
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
force_dot_files=YES
pasv_min_port=40000
pasv_max_port=50000

nginx.conf

server {
        listen 80;
        listen [::]:80;
        # SSL configuration
        #
        # listen 443 ssl default_server;
        # listen [::]:443 ssl default_server;
        #
        # Note: You should disable gzip for SSL traffic.
        # See: https://bugs.debian.org/773332
        #
        # Read up on ssl_ciphers to ensure a secure configuration.
        # See: https://bugs.debian.org/765782
        #
        # Self signed certs generated by the ssl-cert package
        # Don't use them in a production server!
        #
        # include snippets/snakeoil.conf;

        root /var/www/dev.example.com;

        server_name dev. example.com;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ =404;

        }

        location /api/ {

        proxy_pass          http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header    Host             $host;
        proxy_set_header    X-Real-IP        $remote_addr;
        proxy_set_header    X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_read_timeout 1800;
        proxy_connect_timeout 1800;

        }
}

P.S: there's a beer in it for whoever works it out :)

0

Fixed by adjusting: listen=YES listen_ipv6=NO

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.