Server: files:transfer-ownership fails with "The user has at least to be logged in once"

Created on 25 May 2018  路  22Comments  路  Source: nextcloud/server

Steps to reproduce

  1. Create new user
  2. Log in with new user account and log out
  3. Run the following command on the server command line: sudo -u www-data php occ files:transfer-ownership olduser newuser

Expected behaviour

I want to rename an existing user, for that I have to create a new user and then transfer the ownership of the files of the old user, correct? This doesn't work as explained above.

Actual behaviour

The output I then get is:
The target user is not ready to accept files. The user has at least to be logged in once.
To check if the user has logged in according to Nextcloud, I checked the following command.

sudo -u www-data php occ user:info newuser
  - user_id: newuser
  - display_name: My name
  - email: [email protected]
  - cloud_id: [email protected]
  - enabled: true
  - groups:
    - notifications
  - quota: 100 GB
  - last_seen: 2018-05-25T08:14:50+00:00
  - user_directory: /srv/nextcloud/newuser
  - backend: Database

Server configuration

Operating system:
Raspbian 9 (Stretch)

Web server:
Apache 2.4.25-3+deb9u4

Database:
MariaDB 10.1.23-9+deb9u1

PHP version:
PHP 7.0.27-0+deb9u1

Nextcloud version:
13.0.1

Updated from an older Nextcloud/ownCloud or fresh install:
Fresh install of 13, few weeks ago updated within Nextcloud to 13.0.1

Where did you install Nextcloud from:
Official website

Signing status:


Signing status

No errors have been found.

List of activated apps:


App list

Enabled:
  - activity: 2.6.1
  - audioplayer: 2.3.0
  - bruteforcesettings: 1.0.3
  - calendar: 1.6.1
  - comments: 1.3.0
  - contacts: 2.1.3
  - dav: 1.4.6
  - encryption: 2.0.0
  - federatedfilesharing: 1.3.1
  - federation: 1.3.0
  - files: 1.8.0
  - files_pdfviewer: 1.2.1
  - files_sharing: 1.5.0
  - files_texteditor: 2.5.1
  - files_trashbin: 1.3.0
  - files_versions: 1.6.0
  - files_videoplayer: 1.2.0
  - gallery: 18.0.0
  - logreader: 2.0.0
  - lookup_server_connector: 1.1.0
  - news: 12.0.1
  - nextcloud_announcements: 1.2.0
  - notes: 2.3.2
  - notifications: 2.1.2
  - oauth2: 1.1.0
  - password_policy: 1.3.0
  - provisioning_api: 1.3.0
  - radio: 0.6.1
  - rainloop: 5.1.0
  - serverinfo: 1.3.0
  - sharebymail: 1.3.0
  - socialsharing_email: 1.0.3
  - systemtags: 1.3.0
  - tasks: 0.9.6
  - theming: 1.4.4
  - twofactor_backupcodes: 1.2.3
  - twofactor_totp: 1.4.1
  - twofactor_u2f: 1.5.5
  - updatenotification: 1.3.0
  - workflowengine: 1.3.0
Disabled:
  - admin_audit
  - files_external
  - firstrunwizard
  - survey_client
  - user_external
  - user_ldap

Nextcloud configuration:


Config report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            ""
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/",
        "dbtype": "mysql",
        "version": "13.0.2.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "maintenance": false,
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "php",
        "mail_smtpauthtype": "PLAIN",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "enable_previews": "false",
        "htaccess.RewriteBase": "\/",
        "filelocking.enabled": "true",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "updater.release.channel": "production",
        "mail_smtpsecure": "tls",
        "theme": "",
        "loglevel": 2
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...
No

Are you using encryption: yes/no
No

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
No

1. to develop bug encryption (server-side) files filesystem occ

Most helpful comment

If you are having this issue with enabled master key on server side encryption, feel free to give https://github.com/nextcloud/server/pull/21929 a try and review.

All 22 comments

cc @icewind1991 @rullzer

cc @blizzz

I hit the same problem today, Nextcloud 13.0.6 though I use LDAP as backend now (I'm trying to move the local users to ldap).

Any updates for this problem?

That's encryption related. Would mention Bj枚rn, but mobile ui doesn't allow.

Would mention Bj枚rn, but mobile ui doesn't allow.

@schiessle

That's encryption related. Would mention Bj枚rn, but mobile ui doesn't allow.

So, if all files are decrypted, it may work聽?

That's encryption related. Would mention Bj枚rn, but mobile ui doesn't allow.

So, if all files are decrypted, it may work聽?

It does not. I just tested it. Even after deactivating encryption via occ encryption:disable the error The target user is not ready to accept files. The user has at least to be logged in once. occurs.

I'm having the same problem with the Docker image 15.0-apache running on openSUSE Leap 15. Attached is the output of occ config:list for reference.

configs_list.txt

The problem still exists in 15.0.4.

Any hope to see it fixed? I really need to be able to use this feature.

I hit this problem too with nextcloud version 15.0.4 on Debian 8.11 using a docker image.
I'm trying to migrate from a normal user to a LDAP user. Encryption is enabled.

Come on, this is ridiculous, no solutions, not even work arounds for a bug that's almost a year old and was present already two major versions a go!

Same issue

I got the same problem.
Nextcloud version: 15.0.7

Two user logged in

sudo -u nextcloud php occ files:transfer-ownership user1 user2

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

Users Backend: LDAP
Encryption: Enable

EDIT: No any other workaround found to use impersonate to login as user and copy all files locally, remove all and give files to an other user.

Any news for this issue ?

17.0.1 Hello?

Encountered same issue on 16.0.6. Both users logged in and encryption disabled. Both these users backend is database, although LDAP is enabled for most other users.

same here still won't work with 18.0.3

Same problem here (different use case).

It seems to be desired behavior that there can't be any file transfer to a user that hasn't logged in yet (the folder structure for that user doesn't exist yet in this case).
See details in apps/files/lib/Service/OwnershipTransferService.php:

// target user has to be ready
if ($destinationUser->getLastLogin() === 0 || !$this->encryptionManager->isReadyForUser($destinationUid)) {
  throw new TransferOwnershipException("The target user is not ready to accept files. The user has at least to have logged in once.", 2);
}

My use case: import users and automatically assign migrated files to them, which of course doesn't work that way.

My workaround: create files/User Name/migrated_subfolder in the file system (in data directory).

Hi everyone, I have the same problem with Nexcloud 18.03.
My workaround: olduser has all files, and you want to transfer to the newuser.

  1. (olduser) I shared the oldfolder with newuser
  2. (newuser) make a newfolder => for migration
  3. (newuser) right click an copy the content of the oldfolder and select the newfolder
  4. wait until the process is successful
  5. doublecheck everything
  6. delete the oldfolder
  7. delete olduser

Worked for me!!

If you are having this issue with enabled master key on server side encryption, feel free to give https://github.com/nextcloud/server/pull/21929 a try and review.

Thank you @juliushaertl . It works with the suggested changes. Because the changes are not yet on main branch, here is what I did :

  • go to apps/encryption/lib/Crypto/Encryption.php and edit file
  • change the lines 583 to match what is here : https://github.com/nextcloud/server/pull/21929/files
  • save file and lauch your command files:transfer-ownership
  • once you're done, just remove the lines you added, save
Was this page helpful?
0 / 5 - 0 ratings