Copying users to a new instance

Hi

I’m changing servers so I have installed a brand new Nextcloud on the server.

Now I want to move users from the old server to the new one along with their files.

What I have done so far:

  • Created a new user with matching name
  • Moved files from old server to new server
  • Changed permissions to www-data:www-data

Unfortunately all new uploaded files are not visible in user panel. :frowning:

Does anyone know what else should I do to make them visible?

run php occ files:scan --all at the commandline from your install directory of NC

btw: if you would have checked the forum before posting (and taking other actions) you might have found out that you even could have transferred your shares (which are now lost).

meaning: search the forum for similar problems… not even before posting but before taking action as well.

I still have old Nextcloud untouched. Just downloaded files to my computer and then uploaded to new server

well not really untouched.

Ah you mean the new install. Well, I can delete the user?
Or I can create a new nextcloud install

well from what I know from linux systems you can add a user by the same name but it doesn’t mean that he’s gonna have the same user-ID.

anyways… you coud proceed your way, I think… you just need to be aware of the fact that you’re gonna loose your shares (and those of all other users).

the other way round would be a bit more complicate… like getting a dump from DB and adding it to the new one (search the forum on how to do that)

I’m not familiar with shares… Like I said I can install fresh nextcloud instance and do everything that is needed after.

a share is a file that you shared with someone else. those things will be lost.

if you don’t need to care about such (shared) files - go ahead. if it’s only a few shares - go ahead and reshare them.

everything else would cost you some effort (again: search the forum as i am not doing that for you)

I dont really care about shared files then

All I want is to restore files from the previous server so I can access them via web panel

php occ files:scan --all should be enough in your case.
if you would also copy the database, then you could have problems with user id, etc…

Console has to be executed with the user that owns the file config/config.php
Current user id: 0
Owner id of config.php: 33
Try adding 'sudo -u #33' to the beginning of the command (without the single quotes)
If running with 'docker exec' try adding the option '-u 33' to the docker command (without the single qu
otes)

sudo -u #33 php occ files:scan --all

sudo: option requires an argument -- 'u'
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u
            user] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T timeout] [-u
            user] file ...

ls -l config/config.php could show the correct owner

Starting scan for user 1 out of 3 (kleo)
Home storage for user kleo not writable
Make sure you're running the scan command only as the user the web server runs as
Starting scan for user 2 out of 3 (user)
Starting scan for user 3 out of 3 (user2)
Home storage for user user2 not writable
Make sure you're running the scan command only as the user the web server runs as
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 894     | 761   | 00:00:34     |
+---------+-------+--------------+
1 Like

You have a permission issue with the data folder it seems. If you run occ files:scan it should not fail like that. How did you transfer it? Consider using tar with the -p flag to maintain file permissions, or (I think) chown -R www-data:www-data folder.

I haven’t done it like this myself, but it seems to me you could transfer the system in its entirety by moving the 3 main parts:

  • The website
  • The data folder
  • The database

I can see the files but can’t see them (encryption error)

It tells me to change password of the encryption key in personal settings. Did just that and now I’m waiting (it’s been stuck on “Saving” for the past 10 miuntes)