Download
We're evolving to serve you better! This current forum has transitioned to read-only mode. For new discussions, support, and engagement, we've moved to GitHub Discussions.

FTP Upload not working

  • #7904
    Avatar photo[anonymous]

    Hi,

    I’m having problems trying to upload my site to my (shared hosting) server. I fill in the correct login details, selecting ftps, and click “Test connection”, and receive the following response:

    “Error! Application was able to connect with your server but was unable to store files. Please check permissions on your server”

    Being unable to see any permission problem, I attempted to do the upload anyway. It produces a log of several thousand lines long, which I won’t reproduce in full here. What it seems to show is all the directories being set up on the server (and I checked, they are all there, but empty). When it starts trying to write the pages, it returns errors, as follows:

    [Sun, 31 Jul 2022 00:51:54 GMT] [parser] Response: code=250, buffer='OK. Current directory is /'
    [Sun, 31 Jul 2022 00:51:54 GMT] UPL C:/Users/name redacted/Documents/Publii/sites/my-site/output/tags/rhyming-forms/page/2 -> /public_html/publii/tags/rhyming-forms/page/2
    [Sun, 31 Jul 2022 00:51:54 GMT] [connection] > 'PASV'
    [Sun, 31 Jul 2022 00:51:54 GMT] [connection] < '227 Entering Passive Mode (IP redacted)\r\n'
    [Sun, 31 Jul 2022 00:51:54 GMT] [parser] < '227 Entering Passive Mode (IP redacted)\r\n'
    [Sun, 31 Jul 2022 00:51:54 GMT] [parser] Response: code=227, buffer='Entering Passive Mode (IP redacted)'
    [Sun, 31 Jul 2022 00:51:54 GMT] [connection] PASV socket connected
    [Sun, 31 Jul 2022 00:51:54 GMT] [connection] > 'STOR /public_html/publii/wollemi-pine.html'
    [Sun, 31 Jul 2022 00:51:55 GMT] [connection] < '521 Data connection cannot be opened with this PROT setting.\r\n'
    [Sun, 31 Jul 2022 00:51:55 GMT] [parser] < '521 Data connection cannot be opened with this PROT setting.\r\n'
    [Sun, 31 Jul 2022 00:51:55 GMT] [parser] Response: code=521, buffer='Data connection cannot be opened with this PROT setting.'
    [Sun, 31 Jul 2022 00:51:55 GMT] ERROR UPLOAD FILE: /public_html/publii/wollemi-pine.html
    [Sun, 31 Jul 2022 00:51:55 GMT] Error: Data connection cannot be opened with this PROT setting.
    [Sun, 31 Jul 2022 00:51:55 GMT] [connection] > 'PASV'
    [Sun, 31 Jul 2022 00:51:55 GMT] [connection] < '227 Entering Passive Mode (IP redacted)\r\n'
    [Sun, 31 Jul 2022 00:51:55 GMT] [parser] < '227 Entering Passive Mode (IP redacted)\r\n'
    [Sun, 31 Jul 2022 00:51:55 GMT] [parser] Response: code=227, buffer='Entering Passive Mode (IP redacted)'
    [Sun, 31 Jul 2022 00:51:55 GMT] [connection] PASV socket connected
    [Sun, 31 Jul 2022 00:51:55 GMT] [connection] > 'STOR /public_html/publii/wollemi-pine.html'
    [Sun, 31 Jul 2022 00:51:55 GMT] [connection] < '521 Data connection cannot be opened with this PROT setting.\r\n'
    [Sun, 31 Jul 2022 00:51:55 GMT] [parser] < '521 Data connection cannot be opened with this PROT setting.\r\n'
    [Sun, 31 Jul 2022 00:51:55 GMT] [parser] Response: code=521, buffer='Data connection cannot be opened with this PROT setting.'
    [Sun, 31 Jul 2022 00:51:55 GMT] ERROR UPLOAD FILE: /public_html/publii/wollemi-pine.html

    It tries several times for each file, then goes on to the next, yielding the same result.

    So yes, it looks like a permission problem, but the public_html and publii directors are both 755.  And it can create folders.

    I have tried using filezilla to manually transfer the site using the same settings, and it has no problem at all. But that isn’t a long-term solution, I need the inbuilt FTP to work.

    I also tried on another shared server I have with a different hosting company, and it gave the same result.

    If you could provide any clue what might be causing the problem, that would be great.

    thanks.

    #7905
    Avatar photo[anonymous]

    Sorry, forgot to mention: Publii version 0.40.2.

    #7917
    Avatar photo[anonymous]

    Hi,

    As I have found according to your issue:

    <hr />

    Before starting a data transfer (e.g. creating a new data connection outside the control connection to transfer files or listing) you have to specify the protection level using the `PROT` command. The main protection levels are `P` for protected (e.g. SSL encryption) or `C` for clear (no encryption). The server complains, because you don’t specify a protection level and so it does not know how you want to get your data.

    The `PROT` command must be implemented and used by all ftps clients.

    <hr />

    So it seems that your server is not able to handle FTPS protocol used by Publii.

    #7919
    Avatar photo[anonymous]

    Hi Thomasz,

    Thanks for your reply.

    To me, the problem appears to be the opposite to what you suggest. I know the servers(s) can handle ftps, because that is what I use with Filezilla to connect. As I mentioned, this works fine. The server FTP program, Pure-FTPd, not only supports ftps, it requires it.

    The excerpt you quote above is describing what the client needs to do to communicate with an ftps server-side program. In this case, Publii is the client, so the article seems to be saying, if anything, it is Publii that isn’t issuing the PROT command successfully.

    Any other ideas how we could find a cause for this?

    Thanks 🙂

    #7920
    Avatar photo[anonymous]

    @crics – which OS are you using? I suppose that I have a fix, so I can prepare Publii build with this fix for you to test my solution.

    #7921
    Avatar photo[anonymous]

    Hi Tomasz,

    That would be great! I’m using the Windows version.

    Thanks 🙂

    #7922
    Avatar photo[anonymous]

    I will share for you a Windows build with fix today in few hours 🙂

    #7923
    Avatar photo[anonymous]

    Excellent!

    I’ll be asleep then, but will look forward to trying out the fix tomorrow (my time).

    #7924
    Avatar photo[anonymous]
    #7926
    Avatar photo[anonymous]

    Thanks for that, Tomasz. Here’s what I see so far — it’s still not working properly, but it seems a bit better.

    The first time I tried “Test Connection” before uploading, it gave the same error as reported in my original post. But I continued with the upload anyway, and there is some progress here. With the original program, it only ever created the top-level directories and the directories inside them. It didn’t create any HTML pages. But the new version did create the HTML pages in the <webroot>/publii folder, and a bunch of index.html pages in the “tags” subdirectories and “page” subdirectories.

    It’s still hanging though, and as yet no images have appeared in the media folder or its subdirectories, or anywhere else.

    The “Test connection” button has worked the last several times I’ve tried (I repeated the attempt a few times). Odd that it failed the first time.

    Not sure if that helps any, but it seems some progress is being made.

    Thanks 🙂

    #7927
    Avatar photo[anonymous]

    Sorry, I should have mentioned there are none of the PROT error messages on the log now, this is the last little bit of it:

    [Mon, 01 Aug 2022 13:59:14 GMT] UPL C:/Users/xxxx/Documents/Publii/sites/ssssssssss/output/almost-perfect.html -> /public_html/publii/almost-perfect.html
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] > ‘PASV’
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] < ‘227 Entering Passive Mode (ip_addr)\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [parser] < ‘227 Entering Passive Mode (ip_addr)\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [parser] Response: code=227, buffer=’Entering Passive Mode (ip_addr)’
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] PASV socket connected
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] > ‘STOR /public_html/publii/adjectives.html’
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] < ‘150 Accepted data connection\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [parser] < ‘150 Accepted data connection\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [parser] Response: code=150, buffer=’Accepted data connection’
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] < ‘226-File successfully transferred\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] < ‘226 0.015 seconds (measured here), 510.24 Kbytes per second\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [parser] < ‘226-File successfully transferred\r\n’ +
    ‘226 0.015 seconds (measured here), 510.24 Kbytes per second\r\n’
    [Mon, 01 Aug 2022 13:59:14 GMT] [parser] Response: code=226, buffer=’File successfully transferred\r\n’ +
    ‘0.015 seconds (measured here), 510.24 Kbytes per second’
    [Mon, 01 Aug 2022 13:59:14 GMT] UPL C:/Users/xxxx/Documents/Publii/sites/ssssssssss/output/adjectives.html -> /public_html/publii/adjectives.html
    [Mon, 01 Aug 2022 13:59:14 GMT] [connection] > ‘PASV’
    [Mon, 01 Aug 2022 13:59:14 GMT] FTP ERROR: Error: read ECONNRESET
    [Mon, 01 Aug 2022 13:59:14 GMT] FTP CONNECTION CLOSED: false

    I’m thinking I might make a very small test site, just one page with an image, and see what happens.

    #7928
    Avatar photo[anonymous]

    @crics – there is a chance that you will be able to prepare for me some separate FTP account on your server for the test purpose? It seems that there is some compatibility issue between Publii ftp library and your server FTP config. But I must to test it on the real case to find a reason as currently I have no idea why you get this problem.

    If it is possible – you can share temporary access data to tomasz[at]dziuda[dot]com – I will try to deploy some test website to this location.

    #7932
    Avatar photo[anonymous]

    Hi Tomasz,

    That shouldn’t be a problem, but I’ll just need to check with the provider that’s not breaking any of their rules. I’ve got other work I need to get done this morning, so it might be a while before I can get the account created. I’ll get onto it as soon as I can.

    Thanks 🙂

    #7934
    Avatar photo[anonymous]

    @crics – thanks – I will wait 🙂

    #7935
    Avatar photo[anonymous]

    Hi,

    I’ve set up the account and emailed you the details. Good luck 🙂

    #8066
    Avatar photo[anonymous]

    Just an update. I couldn’t get the FTP to work on either of the two shared servers I mentioned, so I set up a VPS and tried two different FTP server programs on that. They didn’t work either. Always getting the ECONNRESET error, with no explanation in the logs as to why. It works with small test with a page or two, but with 40 pages each with a picture, it stops at various points between halfway and 2/3 way through – though not on the same file every time. As mentioned, Filezilla has no problem.

    In the end, I set up a Netlify account, and set Publii to sync to that. It worked first time and every time since, loving it. Maybe it’s the fact the ISPs here have domestic service upload speeds way lower than download, and Netlify is more forgiving. Don’t really know, but I’m glad it’s working – one happy camper.

    Thanks for your help.

    #8098
    Avatar photo[anonymous]

    Publii 0.40.2 (build 15735)

    I’m on Ubuntu 20.04 LTS and trying with the `.deb` client to connect to another Ubuntu server(same version) through SFTP.
    I’m having the same issue here when file permissions are all right but I’m still having:

    Please check file permissions on your server.

    meanwhile connecting through FileZilla on Windows 10 I’m having no issues on connectivity(can list, create/update and delete directories and files).

    #8184
    Avatar photo[anonymous]

    @thepra – please make sure that you have set proper path under SFTP settings. It is possible that Publii tries to put files in the root of the directory where you are logged in during SFTP session.