Avatar of Jasmin shahrzad
Jasmin shahrzad
 asked on

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

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

What is wrong here?
PHPCloud ServicesUbuntuLinuxLinux OS Dev

Avatar of undefined
Last Comment
Jasmin shahrzad

8/22/2022 - Mon
David Favor

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

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

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

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Jasmin shahrzad

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

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.

Jasmin shahrzad

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.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.

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.

Jasmin shahrzad

users has logged in, and storage is created. but not possible to move ownership.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

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

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Jasmin shahrzad

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

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.