[Solved] Virtualmin FTP: Cannot Overwrite Remote File
Virtualmin's default settings are sufficient for most folks out there. But they are no good for websites in active development or production. There are lot of options that needs to be adjusted. Today I'm going to talk about such option.
A newly assigned developer to a website hosted on one of my Managed VPS came to me with following error.
They were using a FTP-only account. Server was configured to use sftp over port 2222. The directories and files had proper permissions for them to read and write files. The only issue was they can't overwrite. They could delete and recreate the files as suggested in the error message. But that wasn't a good solution to the problem.
I went ahead and test it myself using FileZilla. Following was the error I got.
Status: Starting upload of C:\Users\xxxxx\AppData\Local\Temp\fz3temp-2\template-on_air.php
Status: Retrieving directory listing of "/wp-content/themes/eduma-child"...
Status: Listing directory /wp-content/themes/eduma-child
Command: put "C:\Users\tjosm\AppData\Local\Temp\fz3temp-2\template-on_air.php" "template-on_air.php"
Error: /wp-content/themes/eduma-child/template-on_air.php: open for write: permission denied
Error: File transfer failed
There is an easy solution for this, we were getting this because, file overwrite wasn't enabled on ProFTPD server. Turns out that the default setting was not to allow file overwrites. We went ahead and enable file overwrites. In case you find yourself in the same situation, here's how to fix Virtualmin FTP Error: Cannot Overwrite Remote File.
Open ProFTPD configuration file,
Find the following line,
Add following value in a new line immediately after it,
Close file and then restart ProFTPD,
service proftp restart
That should fix the error.