Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I give a user access to a docker volume or path outside the ftp container? #148

Open
jaywork2020 opened this issue Oct 17, 2020 · 6 comments
Labels

Comments

@jaywork2020
Copy link

First of all, I want to thank you for this image.

I set it and and it seems to be working fine. But I need to give a user access files on the server not in the container

for example the following command creates a user called bob and gives him access to /home/ftpusers/bob inside the docker container.

pure-pw useradd bob -f /etc/pure-ftpd/passwd/pureftpd.passwd -m -u ftpuser -d /home/ftpusers/bob

How can I give the user bob access to the /home/ftpusers/bob path on the server not inside the container. Or to a docker volume.

For example, I have another docker container running a wordpress site. I want to be able to FTP into the docker volume that is hosting the wordpress. In my case the WordPress for this container are located on /data/mysitename/pubic_html so I want bob to be able to connect using FTP and manage the files on /data/mysitename/pubic_html.

How can I give a user access to a docker volume or a server location instead on a location on the container?

@stilliard
Copy link
Owner

Hey @jaywork2020 !

Thanks glad it's useful for you.

Sure thing, the workflow generally for this is to have your wordpress container expose the folder you need through a volume, and then expose the same volume to the ftp docker container.

Here's an example doing this using docker compose: https://github.com/stilliard/docker-pure-ftpd/wiki/Docker-stack-with-Wordpress-&-FTP

Hope it helps.

@jaywork2020
Copy link
Author

@stilliard Thank you for your help. Do I still create the user like this when mounting to a path on the server?

Assume my volume is set like this

    volumes:
      - ./data/wordpress:/var/www/html
      - ./data/ftp:/etc/ssl/private
pure-pw useradd bob -f /etc/pure-ftpd/passwd/pureftpd.passwd -m -u ftpuser -d /data/wordpress

I attempted the above, but when trying to FTP into the server it fails. Here are the logs from the FTP attempt

Status:	Resolving address of ftpusa.mydomain.com
Status:	Connecting to SERVER_IP_ADDRESS:21...
Status:	Connection established, waiting for welcome message...
Status:	Insecure server, it does not support FTP over TLS.
Status:	Logged in
Status:	Retrieving directory listing...
Command:	PWD
Response:	257 "/" is your current location
Command:	TYPE I
Response:	200 TYPE is now 8-bit binary
Command:	PASV
Error:	Connection timed out after 20 seconds of inactivity
Error:	Failed to retrieve directory listing
Status:	Disconnected from server
Status:	Resolving address of ftpusa.mydomain.com
Status:	Connecting to SERVER_IP_ADDRESS:21...
Status:	Connection established, waiting for welcome message...
Status:	Insecure server, it does not support FTP over TLS.
Status:	Logged in
Status:	Retrieving directory listing...
Command:	PWD
Response:	257 "/" is your current location
Command:	TYPE I
Response:	200 TYPE is now 8-bit binary
Command:	PASV
Error:	Connection timed out after 20 seconds of inactivity
Error:	Failed to retrieve directory listing

How can I get this to work?

@stilliard
Copy link
Owner

Hi @jaywork2020
Couple things to check, are you setting your PUBLICHOST env param, also are you exposing the needed ports? More info on these in the readme if that helps.

@jaywork2020
Copy link
Author

@stilliard Yes I did

Here is how I create the ftpd_server using the composer file

version: "3"
services:

    ftpd_server:
        image: stilliard/pure-ftpd
        container_name: ftpd_server
        restart: always
        ports:
            - "21:21"
            - "30000-30009:30000-30009"
        environment:
            PUBLICHOST: ftpusa.mydomain.com
        volumes:
            - /data/wordpress_app/public_html:/var/www/html
            - /ftp_data/data:/home/usrname/
            - /ftp_data/passwd:/etc/pure-ftpd/passwd
            - /ftp_data/ssl:/etc/ssl/private

    # Other services were removed
networks:
    default:
       external:
           name: nginx-network

I want the new user to FTP into /data/wordpress_app/public_html or /data/wordpress_app

@stilliard
Copy link
Owner

Hi @jaywork2020
Sorry tor the delay there.

Does the same error happen if you set your ftp user to a non volume folder?

Wondering if it's an issue ftping at all or just with the volumed folder.

Thanks

@inv1sible
Copy link

inv1sible commented Jun 4, 2022

not sure if still an issue, but its open, so....

when mounting volumes in a docker file its - /dir-on-local-host:/dir-inside-container

when using - /data/wordpress_app/public_html:/var/www/html the dir-on-local-host must exist in the desired location on the host (it will be created anyway if not existing) BUT dir-inside-container will be needed in ftp-docker-container... I am pretty sure it is not existing... and will not be created

so you need in ftp docker-compose.yml:

- /data/wordpress_app/public_html:/home/usrname/

and in wordpress docker-compose.yml:

- /data/wordpress_app/public_html:/var/www/html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants