List owncloud users

Hello

I'm looking to use the users list in a bash script on my owncloud server. I looked for a occ command (without LDAP), but I did not find, does it exist?
If not how to operate? Without making a mysql query ... Which would oblige to request id and pw from the database to the user.
Thank you

Hi,

why don't you log in to you db as root and do

select uid from oc_users

you only need the root password.

Hi Patlol,

in 9.1.x there is no such command. However in the upcoming 10.0.3 release this will be possible by using the below commands:

  • user:list --> list users
  • user:list-groups --> list groups for a user

Please refer to the following link for more details: https://doc.owncloud.org/server/10.0/admin_manual/configuration/server/occ_command.html#user-commands-label

Thanks you dimitry and pako81

I dont want use query, because the script doesn't know the mysql root password
I think I will switch to v10...

you know, you can simply cat on the password file and then you will have your password?

something like this:

mysql -u owncloud -p$(cat /etc/owncloud.secret) owncloud -e "Your Command"

But Updating to 10 is always better :slight_smile:

yes dimitry it's a good idea, but /etc/owncloud.secret don't exist on my debian 8 or ubuntu 16 distrib.

But i have /etc/mysql/debian.cnf it's contain

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = xxxxxxxxxxxxxxxxx
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = xxxxxxxxxxxxxxxxx
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

and in my script with

userBdD=$(cat "/etc/mysql/debian.cnf" | grep -m 1 user | awk -F"= " '{ print $2 }')
pwBdD=$(cat "/etc/mysql/debian.cnf" | grep -m 1 password | awk -F"= " '{ print $2 }')
repQuery=$(echo "SELECT * FROM owncloud.oc_group_user;" | mysql -BN -u $userBdD -p$pwBdD)

I've got all I need

glad to hear that :slight_smile:

Hello this comand
user:list
user:list-groups

is removed now !!!???

Fortunately there is the above solution! It is valid for debian 8, 9 and ubuntu 16

They will be added back to the docs soon. However those commands are already available on 10.0.3

Ok i am testing today!!!

with
sudo -u www-data /var/www/owncloud/occ user:list

  [Symfony\Component\Console\Exception\CommandNotFoundException]  
  Command "user:list" is not defined.                             
  Did you mean one of these?                                      
      app:list                                                    
      files_external:list                                         
      market:list                                                 
      config:list                                                 
      encryption:list-modules                                     
      user:sync                                                   
      user:setting                                                
      user:resetpassword                                          
      user:disable                                                
      user:delete                                                 
      user:enable                                                 
      user:lastseen                                               
      user:report                                                 
      user:add

nothing else :cry:
i use owncloud-10.0.2 maybe in version 10.0.3 ...

The commands are available starting with 10.0.3 only. So no 10.0.2..