brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: occ files:transfer-ownership hands a Nextcloud user's files to someone else

Nextcloud
~/tips/tip-nextcloud-transfer-ownership

docker exec --user www-data nextcloud php occ files:transfer-ownership layla fred

Moves files to another account before you remove a user.

Someone leaves the household or the team, and their account holds folders others still need. Deleting the user would take the files along, so move them first.

Name the source user, then the destination:

docker exec --user www-data nextcloud php occ files:transfer-ownership layla fred

The files land in a new subfolder in Fred’s home, so nothing gets mixed up with his own. You can also move a single folder:

docker exec --user www-data nextcloud php occ files:transfer-ownership --path="Documents/Project" layla fred

--move puts the files directly in the destination’s root instead of a subfolder, meant for an empty account. Files that others had shared with Layla are not included unless you add --transfer-incoming-shares=1.

My habit would be to take a database dump and a copy of the data folder first, then check Fred’s account in the web interface, open a few files, and only then disable the old user. Disabling for a while is gentler than deleting right away.

Fred needs room: the files count against his quota from now on. If server side encryption is enabled, both accounts need to be in a usable state, so read that part of the manual before running it. Large transfers take a while, and you shouldn’t interrupt the command halfway.

Further reading: Nextcloud occ files commands

Going deeper: Guide: link Prowlarr to Sonarr and Radarr once, and stop typing indexers into every app

More Nextcloud tips sudo -E -u www-data php occ user:report sudo -E -u www-data php occ app:update --showonly sudo -E -u www-data php occ background-job:history -s 3 -l 10 docker exec --user www-data nextcloud php occ maintenance:mode --on docker exec -it --user www-data nextcloud php occ user:resetpassword layla All Nextcloud tips (13) All topics

Link