docker-pure-ftpd
docker-pure-ftpd copied to clipboard
Can't copy file from bash FTP
Hello,
I run the container using :
docker run -d --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "ADDED_FLAGS=--tls 0" -e "PUBLICHOST=localhost" -e "FTP_MAX_CLIENTS=50" -e FTP_USER_NAME=bob -e FTP_USER_PASS=12345 -e FTP_USER_HOME=/home/bob stilliard/pure-ftpd
but when I run my script to copy file :
HOST=192.168.1.2
USERNAME=bob
PASSWORD=12345
ftp -inv $HOST <<EOF
user $USERNAME $PASSWORD
mput "$TMP_FILE_TO_COPY"
bye
EOF
I get the following error :
Connected to 192.168.1.2.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 2 of 5 allowed.
220-Local time is now 14:41. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
200 OK, UTF-8 enabled
331 User bob OK. Password required
230 OK. Current directory is /
500 I won't open a connection to 192.168.1.2 (only to 172.17.0.1)
425 No data connection
425 No data connection
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
any help please :/
Hey @Gwynevere
Ah yep this is something I run into sometimes too, I think you need to change your docker run command where you have PUBLICHOST=localhost
to PUBLICHOST=192.168.1.2
Let me know if this still doesn't work though, hope it helps.
Hey @Gwynevere
Ah yep this is something I run into sometimes too, I think you need to change your docker run command where you have
PUBLICHOST=localhost
toPUBLICHOST=192.168.1.2
Let me know if this still doesn't work though, hope it helps.
I did but it doesn't work
docker run -d --name ftpd_server -p 21:21 -p 30000-30009:30000-30009 -e "ADDED_FLAGS=--tls 0" -e "PUBLICHOST=192.168.1.2" -e "FTP_MAX_CLIENTS=50" -e FTP_USER_NAME=bob -e FTP_USER_PASS=12345 -e FTP_USER_HOME=/home/bob stilliard/pure-ftpd
Ah ok, maybe try using passive mode with the ftp
command with the -p
flag?
Changing from ftp -inv
to ftp -invp
should handle that, worth a try.
I work with GIt-Bash though, I have the following error, its an unrecognized parameter
Transfers files to and from a computer running an FTP server service
(sometimes called a daemon). Ftp can be used interactively.
FTP [-v] [-d] [-i] [-n] [-g] [-s:filename] [-a] [-A] [-x:sendbuffer] [-r:recvbuffer] [-b:asyncbuffers] [-w:windowsize] [host]
-v Suppresses display of remote server responses.
-n Suppresses auto-login upon initial connection.
-i Turns off interactive prompting during multiple file
transfers.
-d Enables debugging.
-g Disables filename globbing (see GLOB command).
-s:filename Specifies a text file containing FTP commands; the
commands will automatically run after FTP starts.
-a Use any local interface when binding data connection.
-A login as anonymous.
-x:send sockbuf Overrides the default SO_SNDBUF size of 8192.
-r:recv sockbuf Overrides the default SO_RCVBUF size of 8192.
-b:async count Overrides the default async count of 3
-w:windowsize Overrides the default transfer buffer size of 65535.
host Specifies the host name or IP address of the remote
host to connect to.
Notes:
- mget and mput commands take y/n/q for yes/no/quit.
- Use Control-C to abort commands.
Interesting, on linux bash there's a -p flag but yeah looks like the git-bash on windows doesn't have this flag, maybe it doesn't support it but I think an alternative way to enter passive mode is inside your ftp call, under the user $USERNAME $PASSWORD
line but before the mput "$TMP_FILE_TO_COPY"
line you could try adding this line: passive
.
its quote pasv
for ftp.exe
in Windows 10, but it doesn't work neither, I'm gonna try to copy with SCP-Script since WinSCP creates files on FTP server just fine.
Thank you @stilliard
Ah ok, I didn't realise about the windows 10 / git-bash differences for this, I'll have to have more of a look into that some time but glad you have an alternative solution at least.
No problem, let me know if there's anything else I can help with.