Copy files to user's directory

Nextcloud version (eg, 12.0.2): 17.0.2.
Operating system and version (eg, Ubuntu 17.04): Ubuntu Server 18.04 LTS
Apache or nginx version (eg, Apache 2.4.25): nginx
PHP version (eg, 7.1): 7.2

The issue you are facing:
I want to create a new user in my Nextcloud instance and copy the files directly into their directory.

Is this the first time you’ve seen this error? (Y/N):

Steps to replicate it:

  1. sudo -u www-data php /var/www/nextcloud/occ user:add --display-name=“Guido van Harten” --group=“Home” guido
  2. cp -R /var/nextcloud_data/guido/files

I think the user has to activate his account before I can copy files to their data directory.
Is there a command to activate their account?

Hi Guido_van_Harten,

nextcloud works with a database.
When you directly copy files into a folder, you do it under the radar of database.
The database is unknowing, what’s going on.

Try: sudo -u www-data php occ files:scan --all
and give me a feedback.



If you have a standard set of files you want every user created with, then you could put them in the skeleton directory.

When the admin created the new user a new directory is NOT created in /var/nextcloud_data UNTIL the new user logged into the webinterface, so I am not able to copy files directly to the user’s directory.
Is there a command to activate their account where also the user’s directory is created?
After the command @soyo suggested, the new user’s directory is not created.

Hi Guido,
I just tested to create a new user. After ca. 5 minutes the user directory was created by NC himself. I didn’t have to login as the new user.

But what I have done: Long time ago I changed the config.php by adding the following line:
‘share_folder’ => ‘/Shared with me’

In this way the folder will be created automatically and you can share your files with your new user. It is not the same effect as Ascendancer suggested with the skeleton directory, because I didn’t touch the default skeleton template.

Now I created the folder “testordner” and a testfile.txt with nano as shell admin. Then I changed the owner and group for both to www-data.

And after the first login as the new user the skeleton was created, and the generated new folder and the testfile.txt was shown. I didn’t need the command I suggested in my first answer.

Hope it helps.