dockerftpalpine-linuxlftp

ftp [vsftpd] gives me "500 OOPS: child died" under alpine


I have setup ftp within a fresh alpine container, and installed lftp client to test ftp with it, but it seems doesn't working giving me the following error: [500 OOPS: child died]

my setup and configuration seems ok, but not sure why it won't work.

Here is my setup:

Dockerfile:

FROM alpine:3.19

RUN apk upgrade && apk update
RUN apk add lftp vsftpd

RUN adduser -D tofaha 
RUN echo tofaha:1337 | chpasswd 

RUN \
        echo "listen=YES" > /etc/vsftpd/vsftpd.conf; \
        echo "local_enable=YES" >> /etc/vsftpd/vsftpd.conf; \
        echo "write_enable=YES" >> /etc/vsftpd/vsftpd.conf; \
        echo "anonymous_enable=NO" >> /etc/vsftpd/vsftpd.conf; \
        echo "chroot_local_user=YES" >> /etc/vsftpd/vsftpd.conf; \
        echo "allow_writeable_chroot=YES" >> /etc/vsftpd/vsftpd.conf;

CMD vsftpd /etc/vsftpd/vsftpd.conf

EXPOSE 21

and then I build the image and run it using :

docker build . -t my-ftp
docker run -d -p 21:21 --name ftp-cont my-ftp

enter the container shell :

docker exec -it ftp-cont sh

then connect to ftp using lftp client:

lftp localhost -u tofaha
# Password is 1337
lftp tofaha@localhost:~>

then when I try to list or create a directory, it gives me this error:

lftp tofaha@localhost:~> ls
`ls' at 0 [500 OOPS: child died]

Any Idea?


Solution

  • Well, It turns out that I need to add this line within vsftpd configuration:

    seccomp_sandbox=NO
    

    thanks to this post which says :

    With version 3.0 of vsftpd, a new feature was introduced and it appears that this has caused problems for a few people. That feature is seccomp sandboxing and it can turned off by adding the following line in /etc/vsftpd.conf: seccomp_sandbox=NO

    edit the vsftpd.conf file, which in my case is available in this path /etc/vsftpd/vsftpd.conf , and add the above line to it.

    don't forget to restart the vsftpd service in order to apply the new configuration.

    or update the dockerfile to the following :

    Dockerfile:

    FROM alpine:3.19
    
    RUN apk upgrade && apk update
    RUN apk add lftp vsftpd
    
    RUN adduser -D tofaha 
    RUN echo tofaha:1337 | chpasswd 
    
    RUN \
            echo "listen=YES" > /etc/vsftpd/vsftpd.conf; \
            echo "local_enable=YES" >> /etc/vsftpd/vsftpd.conf; \
            echo "write_enable=YES" >> /etc/vsftpd/vsftpd.conf; \
            echo "anonymous_enable=NO" >> /etc/vsftpd/vsftpd.conf; \
            echo "chroot_local_user=YES" >> /etc/vsftpd/vsftpd.conf; \
            echo "allow_writeable_chroot=YES" >> /etc/vsftpd/vsftpd.conf; \
            echo "seccomp_sandbox=NO" >> /etc/vsftpd/vsftpd.conf;           # NOTE this new line
    
    CMD vsftpd /etc/vsftpd/vsftpd.conf
    
    EXPOSE 21