Did you create the user, where the user has never logged on? in that case all data structures for that user are missing.
(A user entry as such only creates the right to access...)
All the data, directory etc. etc. is done during first logon.
After first logon you can do what you want.
@david: for nextcloud ssh access is normaly NOT available.
For a Host admin it probably is. You can subscribe to Nextcloud SP's where you definitely have NO ssh access.
You should try it once... it has some very useful stuff... and is compliant to GDPR, probably also CA, US law on customer protection..
First this has nothing to do with logged on or not....
If you create a user test (only nextcloud) and store some stuff there....
then your create a user test2 and call sudo -u www-data php occ files:transfer-owner test test2 then all files from user test are transfered to a folder named 'transferred from test on 2020-02-02 16-03-10' inside the "test2" account. The test account has no more files/folders.
Also all shared stuff that used to be from test will be from test2 to others...
This is probably not what you are looking for.
(ownership IN nextcloud is only the place in the folder structure below a user).
The location of the data directory is described in the config.php file. ( lets assume this is /data )
The user specific data is below this so /data/test contains everything that belongs to user test.
The files for user test are below: /data/test/files ( cached info is in /data/test/cache )
What is presented on the browser window is from the database. When you create / remove/ share a file only some registration in the database is done.
besides doing some stuff on the disk.
When you create files "behind" nextcloud in that directory nothing will be shown until you do a files:rescan for that user.
Nextcloud ownership has no relationship whatsoever to linux/windows ownership.
The only requirement is that the webservice (apache + mod_php) or php-fpm can maniputae the files., which means www-data must be the (unix/windows) owner of the files.
Nextcloud CAN work without unix integration as far as unix integration is used than only as authentication source nothing else. No home directory (the webserver / php-fpm service) would not be able to touch/read/write... files in those directories. Al kinds of services can be used as authentication source (effectively only a password checking source), Among those services: Unix pam, LDAP, SharePoint, OAuth2, etc. etc.
If the target user has been logged on once the directories and other scaffolding in the database & storage have been created.
I'll check the code later, if there are more requirements that advertised.
(sorry for all the colours, i am using the beta functions on the site seems it needs a bit of work still, i cannot get rid of them).
Likely what's meant is an ssh login, rather than whatever "web access" might mean.
In other words, the actual "destination-user" system accounting must be... incremented... to show user is real...
Try an ssh login, then run your operation again.