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

Question: How to connect for the ftp server from external application? #129

Closed
Assafkalfa opened this issue Mar 30, 2020 · 10 comments
Closed

Comments

@Assafkalfa
Copy link

Assafkalfa commented Mar 30, 2020

Hello and I'm sorry if my question is a little stupid. I'm not a DevOps and never created a server. But need to check some things and have no time to wait for our DevOps to establsh new server...

I run the image and success to enter the server :)
Need a help with how to connect to the server, for example with FileZila.

I try this:
docker run -d --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "PUBLICHOST=localhost" stilliard/pure-ftpd

But didn't success to make connection (host: localhost; port: 21; username and password empty, pure_ftpd, stillard, ftpd_server...)

Will be glad for help (also to add a password for the connection will be nice too)
Sorry for the simple question..

Thank you!

P.S. Env: Windows

@stilliard
Copy link
Owner

stilliard commented Mar 30, 2020

Hi @Assafkalfa
Happy to help out.

After running the container you need to exec into the container and setup the user/password, here's a guide for this:
https://github.com/stilliard/docker-pure-ftpd#example-usage-once-inside

Alternatively, you can start the container with a user and password setup automatically, see here:
https://github.com/stilliard/docker-pure-ftpd#setting-runtime-ftp-user

Hope this helps.

@Assafkalfa
Copy link
Author

Really thank you, looks like I missed this section by mistake..
Thanks again!, I'll take a look (probably tomorrow..)

Assaf

@samklonaris
Copy link

Related to this - I am also having trouble connecting using a python client.

docker run -e FTP_USER_NAME=bob -e FTP_USER_PASS=12345 -e FTP_USER_HOME=/home/bob -e "ADDED_FLAGS=-d -d" -e FTP_PASSIVE_PORTS=10000:10009 --expose=10000-10009 --rm -d --name ftpd_server -p 21:21 -p 10000-10009:10000-10009 -p 30000-30009:30000-30009 stilliard/pure-ftpd bash /run.sh -c 30 -C 10 -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P localhost -p 30000:30059
ftp = FTP()
ftp.connect('localhost', 21)
ftp.login('bob', '12345')

filepath = 'test.csv'
ftp.storbinary(f'STOR {filepath}', open(filepath, 'rb'))
>>> ConnectionRefusedError: [Errno 61] Connection refused

The client is in passive mode, but wondering if i'm not configuring the server correctly

@stilliard
Copy link
Owner

Hi @srklonaris
Ah interesting, I'm not spotting anything off with your setup, sorry that's not much help.
Maybe if you haven't already, try checking the output of docker ps or docker port ftpd_server to make sure the ports are properly listed. Also maybe check docker logs ftpd_server to see if anything in the log output helps point you in the right direction. I hope this was helpful.

@Assafkalfa
Copy link
Author

Hi

I tried the commands but still not success, will be glad for some more help please.
Below is the screenshot:

sftpConnection

I enter the sftp and create a user.
I didn't find a directory with my name in home/ftpusers
And failed to connect to the server from remote

Thank you very much !!
Assaf

@samklonaris
Copy link

@stilliard Thanks for the quick response. Figured it out, I was not exposing the right port range

@stilliard
Copy link
Owner

@srklonaris that's fantastic & you're welcome.

@Assafkalfa ah no worries, could you please try checking the output of docker ps or docker port ftpd_server to make sure the ports are properly listed as well as maybe checking docker logs ftpd_server to see if anything in the log output. If still no luck can you paste me the output from the docker logs command, thank you.

@Assafkalfa
Copy link
Author

Assafkalfa commented Mar 31, 2020

Thank you very much I really appreciate your patience and willingness to help!

This the log I saw in the docker:

Creating user...
Password:
Enter it again:
root user give /home/assaf directory ftpuser owner
Setting default port range to: 30000:30009
Setting default max clients to: 5
Setting default max connections per ip to: 5
Starting Pure-FTPd:
pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P localhost -p 30000:30009 -c 5 -C 5

I tried localhost, assaf, my password, 30000 and 30009, still failed to connect (via fileMozila, Windows).

Below are docker outputs:

dockerConsole

@stilliard
Copy link
Owner

No problem at all.

Your setup looks good to me, I'm thinking maybe it's a firewall issue.

Couple things to check:

  1. I noticed in the screenshot your filepath is under CodeCloud? I don't know what this is but is the container running locally on your machine or on a remote/cloud machine? If remote, you'd want to use the IP instead of localhost both when starting the container and when connecting.

  2. If it's running locally on your machine, maybe it's a firewall issue? I'm not on windows so I don't know much about where this is setup sorry but it might be you need to change your internal firewall settings to allow internal connections on that port.

Hope some of the above helps

@Assafkalfa
Copy link
Author

@stilliard Thank you very much!
Good to know I'm OK :)
In this case CodeCloud is a local directory (meanwhile..).
I'll check the Firewall (actaully I'm working on the company laptop, maybe they block something..)

Thanks again!!
Assaf

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

No branches or pull requests

3 participants