Copying data to Nextcloud via FTP

Suppose you need to copy data via FTP to Nextcloud.
Configure the FTP server if it is not configured, for example, as I described in the article:
Configuring ProFTPd with virtual users in a file

Create an FTP user that will work on behalf of the user and the www-data (uid 33) group:

sudo ftpasswd --passwd --file=/etc/proftpd/ftpd.passwd --name=test --uid=33 --gid=33 --home=/var/www/nextcloud/data/USER/files/FTP/ --shell=/bin/false

Now if you copy files via FTP, they will not be visible in Nextcloud, if you delete files via FTP, they will remain in Nextcloud, so to update the cache, execute:

cd /var/www/nextcloud
sudo -u www-data php occ files:scan --all

To automatically update the cache, you can make a script:

cd /var/www/nextcloud
sudo -u www-data php occ files:scan --all --no-interaction --quiet

And add it to /etc/crontab (for example, to run hourly):

1 * * * * root /dir/

See my articles:
Install Nextcloud in Ubuntu
Using and configuring CRON

Did my article help you? How about buying me a cup of coffee as an encouragement? Buy me a coffe.

Leave a comment

Leave a Reply