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ā€™
?