Patlol
July 29, 2017, 2:48pm
1
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
dmitry
July 30, 2017, 9:24pm
2
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.
pako81
July 31, 2017, 12:31pm
3
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
Patlol
July 31, 2017, 2:15pm
4
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...
dmitry
July 31, 2017, 7:49pm
5
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
Patlol
August 27, 2017, 8:15pm
6
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
Patlol
September 26, 2017, 11:50am
8
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
pako81
September 26, 2017, 11:52am
9
They will be added back to the docs soon. However those commands are already available on 10.0.3
Patlol
September 26, 2017, 10:22pm
11
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 i use owncloud-10.0.2 maybe in version 10.0.3 ...
pako81
September 29, 2017, 8:52am
12
The commands are available starting with 10.0.3 only. So no 10.0.2..