owncloud / files_external_ftp

Flysystem based ftp backend for ownCloud
GNU Affero General Public License v3.0
10 stars 7 forks source link

FTP only works with subdirectories #17

Open ekgermann opened 7 years ago

ekgermann commented 7 years ago

Installed from Marketplace files_external_ftp app.

Either in user or admin Storage area, I try to define an external FTP source. The status icon shows red.

In attempt to debug, I started a tshark capture and no traffic is generated from the host towards the FTP server.

Is there a prerequisite I'm missing? PHP is 7.1.5 built from source with --enable-ftp ticked. phpinfo indicates ftp and ftps streams are enabled. Setting owncloud logging to info,warnings,errors and fatal issues shows nothing in the logs.

System Status installed true maintenance false needsDbUpgrade false version 10.0.1.5 versionstring 10.0.1 edition Community productname ownCloud

Debugging pointers appreciated.

cmonjeau commented 7 years ago

Hi,

I've the same issue with the 10.0.2 owncloud release. I've tried in a docker container too but it's the same problem.

A part of the response : "statusMessage":"League\Flysystem\FileNotFoundException: File not found at path: "

@owncloud-bot @PVince81 @DeepDiver1975 Have you observed this trouble?

Commifreak commented 7 years ago

Got exact same:

League\Flysystem\FileNotFoundException: File not found at path: 
cmonjeau commented 7 years ago

Hi @PVince81 @DeepDiver1975 or someone else,

I've tried with the 10.0.3 owncloud release and always the same issue, FTP connection doesn't work at all.

It's a problem because I can't update my Owncloud because it's an important feature for my institution.

francesco74 commented 7 years ago

Same for me. FTP work only on subdirectory not on root. On root directory no connection at all to server. Owncloud version 10.0.3

PVince81 commented 7 years ago

Does it work for everyone on subdirectories ? If yes, maybe it's just a simple path computation bug which would be good news and easy to fix.

PVince81 commented 7 years ago

Can you try adding a "/" instead of subdirectory in the configuration instead of leaving it empty, in case that helps ?

cmonjeau commented 7 years ago

Hi,

indeed, it works only with subdirectories but not on root, even with adding /.

Thanks for your replies!!

francesco74 commented 7 years ago

Me too, even with "/", no connection to root directory.

PVince81 commented 7 years ago

Is there a docker instance with the same FTP server software that could be used to reproduce this quickly ? (I don't have an FTP instance locally for trying this)

The automated tests are currently running against vsftpd (https://github.com/owncloud/files_external_ftp/blob/master/.travis.yml#L28).

Can you guys post what FTP server software you are using ?

cmonjeau commented 7 years ago

Hi,

I use a proftpd server.

Maybe you can test with this public FTP server :

host : speedtest.tele2.net user : anonymous pwd : whatever root : / not working but /upload works for example

Thank for you working on it.

cmonjeau commented 7 years ago

Hi @PVince81, any progress on it?

PVince81 commented 7 years ago

Can you guys try replacing "/" with "" here: https://github.com/owncloud/files_external_ftp/blob/master/lib/Storage/FTP.php#L55 ?

It seems the slash might be doubled here: https://github.com/owncloud/files_external_ftp/blob/master/lib/Storage/FTP.php#L72 and maybe ProFTP doesn't like it ?

(I don't have time to debug this myself right now, sorry)

francesco74 commented 7 years ago

Even with "" instead of "/" not work for me. (P.S. I'm using pureFTP on a local server for testing)

cmonjeau commented 7 years ago

Not good for me too :/

PVince81 commented 7 years ago

found a docker here: https://hub.docker.com/r/aexea/proftpd/

patrickjahns commented 6 years ago

I've also encountered this problem:

Using this docker to verify:

docker run \
   --name vsftpd \
   -d \
   -e FTP_USER=test \
   -e FTP_PASS=test\
   -p 20-21:20-21 \
   -p 21100-21110:21100-21110 \
   million12/vsftpd

With ftp utility I can connect - create directories, upload files etc. no problems

In owncloud I get this: image

And the exception in the json reply:

{
"id":1,
"mountPoint":"\/FTP",
"backend":"ftp",
"authMechanism":"builtin::builtin",
"backendOptions":{"username":"test","password":"test","host":"ftpd","root":"","port":"","secure":false},"priority":100,"mountOptions":{"encrypt":true,"previews":true,"enable_sharing":false,"filesystem_check_changes":1,"encoding_compatibility":false},
"status":1,
"statusMessage":"League\\Flysystem\\FileNotFoundException: File not found at path: ",
"userProvided":false,
"type":"system"
}

With a subdirectory previously created on the ftp it works: image

Json answer:

{
"id":1,
"mountPoint":"\/FTP",
"backend":"ftp"
,"authMechanism":"builtin::builtin",
"backendOptions":{"username":"test","password":"test","host":"ftpd","root":"test","port":"","secure":false},"priority":100,"mountOptions":{"encrypt":true,"previews":true,"enable_sharing":false,"filesystem_check_changes":1,"encoding_compatibility":false},
"status":0,
"userProvided":false,
"type":"system"
}

cc @PVince81 - let me know if you need further details on this

mmattel commented 5 years ago

Is there any update on the ftp sub dir issue ?

jvillafanez commented 5 years ago

The only thing I can say for now is that it might not be possible to fetch the required information from the root folder of the ftp server. The flysystem has some additional checks about file existence. The exception is one of them. Basically, it can't find that "" path (the root one)

I don't know for sure if it's a bug in the flysystem, or we'll have to patch it anyway because we can't get the information for the root folder.

gekoul commented 5 years ago

A little bit of random debugging from me. I tried all possible combinations ( "", "/", \/ , , ./ , /.. , etc. Νothing works and i get a monotonous "Message\":\"File not found at path: \"

Things got a bit out of the ordinary when I opted for ../ as a root folder and then I got the expected error "message":"Exception: {\"Exception\":\"LogicException\",\"Message\":\"Path is outside of the defined root, path: [..]\"

There might be a possibility that the system sends the correct path but the ftp server is messing up with the reply, or reply is not understood correctly.

PVince81 commented 5 years ago

@jvillafanez can we use a virtual entry for root then ?

jvillafanez commented 5 years ago

we can fake the information based on the contents of the folder, but it might be expensive if there is a lot of content. Not sure if there is any other alternative.

gekoul commented 5 years ago

@PVince81 @jvillafanez I'm not sure i understand the notion of virtual entry in this context. I cannot thing of a virtual anything when it comes to / directory on ftp server. BTW tests are performed on vsftpd on Centos 7.

PVince81 commented 5 years ago

the main problem as I understand is that a FTP server does not return any metadata for the root entry. So we don't have metadata like "folder size", "mtime", etc, so we cannot represent that node inside of ownCloud with real information. The idea above is that instead of asking the FTP server, ownCloud populates its internal root node information with computed information. This means it would need to retrieve the contents of the root folder and calculate the total size and maybe max(mtime) to set it on the root node. This information would likely be cached in oc_filecache, @jvillafanez, so would only need to be computed once.

The mtime is important to be able to detect changes that happened remotely.

jvillafanez commented 5 years ago

I think we'll also need to compute the mtime based on the contents. If this the case, this will be expensive because we'll have to scan the contents to know if something has changed.

mmattel commented 5 years ago

but only for the root dir - or?

PVince81 commented 5 years ago

in this case "a bit expensive" is likely more desirable than "not working at all" I guess

piotrekzielony commented 2 years ago

Any updates on this?

I have some legacy devices running FTP and I'd like to have top / directory visible

ChristophorusReyhan commented 1 year ago

still not working

IboSmiles commented 8 months ago

For me this worked.

I just used "/tmp/.." as directory. The "tmp" folder doesn't even exists.