stilliard / docker-pure-ftpd

Docker Pure-ftpd Server
https://hub.docker.com/r/stilliard/pure-ftpd/
MIT License
846 stars 325 forks source link

Rename/move functionality with authenticated user? #155

Closed KimEeckhout closed 3 years ago

KimEeckhout commented 3 years ago

Hi,

I'm fairly new to this so I'm not sure if what I'm encountering is user error or a bug.

I have the server up and running fine in my docker environment. I have authentication enabled, and I can connect to it from my host, and from within the docker network. I can create directories, upload files, and delete them.

What I cannot get to work however, is renaming (moving) files, under any circumstances. It doesn't seem permission related because even renaming a file I just uploaded (simple rename, not moving directory) fails. Moving between any 2 directories also fails, even if I can upload and delete files in those directories.

The response I get is always the same: 550 Rename/move failure

I've enabled the verbose logging, but that didn't yield any hints either:

Feb 10 17:25:08 86169ce9051c pure-ftpd: (elexon@172.21.0.1) [DEBUG] Command [rnfr] [/temp/foo.txt]
Feb 10 17:25:24 86169ce9051c pure-ftpd: (elexon@172.21.0.1) [DEBUG] Command [rnfr] [/temp/foo.txt]

The above log is from 2 attempts to move (rename) /temp/foo.txt to /inbox/foo.txt. I only see the RNFR command coming through, it never gets to RNTO.

Do you have any idea what could be going wrong here?

stilliard commented 3 years ago

Hey @Mopper

No worries at all, are you using the default / latest tag or hardened one? I think in the hardened one we add -G which indicates no rename.

I've tested on the default / latest tag instead with an upload, rename and delete to make sure it's working:

$ ftp -p localhost 21
Connected to localhost.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 5 allowed.
220-Local time is now 11:43. 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.
Name (localhost:andrew): bob
331 User bob OK. Password required
Password:
230 OK. Current directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> 
ftp> put README.md 
local: README.md remote: README.md
227 Entering Passive Mode (127,0,0,1,117,52)
150 Accepted data connection
226-File successfully transferred
226 0.001 seconds (measured here), 22.06 Mbytes per second
12818 bytes sent in 0.00 secs (119.8451 MB/s)
ftp> 
ftp> ls
227 Entering Passive Mode (127,0,0,1,117,55)
150 Accepted data connection
-rw-r--r--    1 1000       ftpgroup        12818 Feb 11 11:43 README.md
226-Options: -l 
226 1 matches total
ftp> 
ftp> rename README.md MOVED-TEST.md
350 RNFR accepted - file exists, ready for destination
250 File successfully renamed or moved
ftp> 
ftp> ls
227 Entering Passive Mode (127,0,0,1,117,54)
150 Accepted data connection
-rw-r--r--    1 1000       ftpgroup        12818 Feb 11 11:43 MOVED-TEST.md
226-Options: -l 
226 1 matches total
ftp> 
ftp> delete MOVED-TEST.md
250 Deleted MOVED-TEST.md
ftp> 
ftp> ls
227 Entering Passive Mode (127,0,0,1,117,57)
150 Accepted data connection
226-Options: -l 
226 0 matches total
ftp> 
KimEeckhout commented 3 years ago

Thanks for the quick response @stilliard !

I'm indeed using the hardened image, and that does indeed run with -G:

pure-ftpd -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -j -R -P ftp-server -s -A -j -Z -H -4 -E -R -G -X -x -d -p 30000:30009 -c 5 -C 5

I've switched to the default image now and there the rename/move works without a hitch.

Thanks for taking the time to point this out - I had no idea that there was a flag to disable renaming and never thought to inspect all the arguments :/