Suggestion re - username

I am not a developer and this is a suggestion based on what happened to me.
I created a Nextcloud instance with 12 people gave them all usernames that was just their name ‘John Smith’
As a result I cannot now mention them in comments as they do not appear, so I can’t do @John Smith - it doesn’t work.
And since there is no @John as a username I get @unknownuser

I think when someone creates the username - Nextcloud should not accept a user name with space in the middle.

If anyone has a fix for this I’d be interested - othere wise I need to delete 12 users and recreate them. Which seems to be a hassle.
Thanks for Nextcloud. I love it

What happens if you rename the user (in the user editor). Use a . or _ between first & last names.

I would test with just one user first.

Scratch that… Looks like there’s no way to rename. You need to create new then transfer data. See this link Rename user account / move user data

1 Like

Lol you linked to my other post.
Thank you.

Hi
Thank you for the info.
The post you linked provides a command line that does not work on my system

NextCloudPi version v1.34.7
NextCloudPi image NextCloudPi_09-05-20
distribution Raspbian GNU/Linux 10 \n \l

it produces error
pi@nextcloudpi:~ $ php -u www-data php occ files:transfer-ownership Sherab1 Sherab10
Error in argument 1, char 2: option not found u

also when changing the -u into either with or without -a
here’s the error

pi@nextcloudpi:~ $ sudo php  www-data php occ files:transfer-ownership Sherab1  Sherab10

Could not open input file: www-data

@wisdomlight please read this:

pi@nextcloudpi:~ $ sudo -u www-data php occ files:transfer-ownership Sherab1  Sherab10

gives this error

Could not open input file: www-data

Have you noticed the difference between:
pi@nextcloudpi:~ $ sudo php www-data php occ files:transfer-ownership Sherab1 Sherab10
and
pi@nextcloudpi:~ $ sudo -u www-data php occ files:transfer-ownership Sherab1 Sherab10
?

This is the original suggestion from the link posted above

php -u www-data php occ files:transfer-ownership <source-user> <destination-user>

But it produced an error
you suggested the below

sudo -u www-data php occ files:transfer-ownership Sherab1 Sherab10 

But it also produced error.
Now you suggested

I see the difference between these two lines but I obviously miss something because you suggested the second line.
So what am I missing ??
to my mind something is missing before the -u
but I am not a coder so I just copied what was there.

Command line incorrect…

Unless you change to the folder /var/www/nextcloud first, you need to enter

sudo -u www-data php /var/www/nextcloud/occ …

1 Like

@das1996
Thanks
I would have never caught on to this.
We simple users believe the info here in the help is coming from god…:wink: with no mistakes in it.

ok I tried it and here’s the results

root@nextcloudpi:/var/www/nextcloud# -u www-data php occ files:transfer-ownership Sherab1 Sherab10
bash: -u: command not found

then i tried

root@nextcloudpi:/var/www/nextcloud# php -u www-data php occ files:transfer-ownership Sherab1   Sherab10

produced the following

Error in argument 1, char 2: option not found u

when i am as a sudo su root user
here’s the output of ls

root@nextcloudpi:/var/www/nextcloud# ls
3rdparty  config       core      index.html  occ           ocs-provider  resources   themes
apps      console.php  cron.php  index.php   ocm-provider  public.php    robots.txt  updater
AUTHORS   COPYING      data      lib         ocs           remote.php    status.php  version.php

Is it possible that there’s a file or folder missing?
I can’t find the data folders of all the users

No super expert here… Mainly windows user who’s been having to learn this as I go along.

root@nextcloud:~# sudo -u www-data php /var/www/nextcloud/occ files:transfer-ownership USER1 USER2
Validating quota
Analysing files of USER1…
0 [->--------------------------]
Collecting all share information for files and folders of USER1 …
5 [============================]
Transferring files to test/files/transferred from Julian on 2021-02-04 19-36-15 …
Restoring shares …
Share with id 1 points at deleted file, skipping
1/5 [=====>----------------------] 20%Share with id 9 points at deleted file, skipping
Share with id 10 points at deleted file, skipping
Share with id 15 points at deleted file, skipping
Share with id 17 points at deleted file, skipping
5/5 [============================] 100%
root@nextcloud:~#

This transfers files but not things like calendar. Probably need to export/import that? This seems clunky… The original user above has a few external storage mapped shares, so I think that’s what is being skipped.

Thank you it worked.
I just can’t see the difference between what I did and your last line.
But it worked.
Thank you again.

This can be broken down to 4 sections:

  1. sudo -u www-data >> execute command that follows as user www-data
  2. php >> parser for processing php files
  3. occ >> a php script to pass to 2
  4. files:transfer-ownership USER1 USER2 >> parameters passed to the occ script

Each section is a separate entity of sorts. In english this can be translated to;

Run command php as user www-data using script occ with parameters files:transfer-ownership USER1 USER2

Paths and case are very important

2 Likes

You’re a treat.

Of course -u for user
What kind of user is user www-data?
and why did the command not work when I was as a root user in the /var/www/nextcloud/ folder where occ file exits?

Thanks for taking the time to explain.

That I can’t answer. There’s probably checks within the script to fault if its run by anyone other than www-data. Security?

www-data is the user that’s assigned to the nextcloud website and data files. Keep in mind, occ is a php script, not an actual executable binary.

1 Like

Might it be with the fact that my DataDir is on external HD??
It is under /media/segate-external/ncdatat/‘all my users data directory are here’
?