We help IT Professionals succeed at work.

ownership moving error?

nextcloud issue:
i try to move ownership from one to other user:
both users has logged in to web access
i do the following from command line
sudo -u www-data php occ files:transfer-ownership "source-user" "destination-user

Error:
The target user is not ready to accept files. The user has at least to be logged in once.

What is wrong here?
Comment
Watch Question

David FavorFractional CTO
Distinguished Expert 2019

Commented:
You said, "both users has logged in to web access" which provides a clue.

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.

Author

Commented:
ok. but my user is not linux users and nextcloud is not connected to Active directory.
Users is a locally nextcloud users.
i can see my users under (on linux dir /nextcloud) then as root wrote
sudo -u www-data php occ files:transfer-ownership "source-user" "destination-user
nociSoftware Engineer
Distinguished Expert 2019

Commented:

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..  


Author

Commented:
@noci, I log in as users both. Actully both users has Create some directories.
But When i look at auth.log the error say pam_unix session is opend for users www-data and 2 Second after closed(pam_unix)
The server is joind Active Directory (samba) but I do not have a users www-data in My users.
Maybe i need to have some.
nociSoftware Engineer
Distinguished Expert 2019

Commented:

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.

Author

Commented:
ok i understand the file structure on nextcloud.
but what is wrong here why i can't move ownership.
the example you describe, it's exactly what i want. i have a user and i want to move every things under this user to other share directory and .... .
but not to delete user1. all users has until now it should move to other then after that user 1 exist as normal user.
nociSoftware Engineer
Distinguished Expert 2019

Commented:

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.

Author

Commented:
Thanks,
users has logged in, and storage is created. but not possible to move ownership.
Software Engineer
Distinguished Expert 2019
Commented:

There is a link to encrypted storage.

Are you using that?   during the transfer the encryption needs to be disabled for both source & target.

For the internal files The directory is renamed... (which would cause a key clash).

For the source the error is different for encrypted files, ( "Some files are encrypted - please decrypt them first" )


nociSoftware Engineer
Distinguished Expert 2019

Commented:

(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).

Author

Commented:
Thanks noci. it was correct i have had cryption on for users i stop it for 2 users and now i can move ownership.
Like always you was right.

Author

Commented:
Thanks noci. it was correct i have had cryption on for users i stop it for 2 users and now i can move ownership.
Like always you was right.