Posts Tagged ‘command line reset pass own cloud’

How to reset lost OwnCloud admin password credentials with Linux command

Friday, September 28th, 2018


Some time ago I've explained how to set-up a personal Cloud via OwnCloud on Linux to be able to access and share your data across all your Phone / Notebook / PCs / Tablet devices and be free from Amazon Cloud slavery.

Now as I haven't used a setup of OwnCloud it seems I forgot my OwnCloud password and besides that I am not sure which email address I filled as a recovery email and was lazy to go through all the OwnCloud MySQL database tables, thus I looked for
other ways to recover the forgotten password. Finally I ended up using the command line, below is how OwnCloud 7 admin password can be easily reset (recovered) with occ php command:


root@pcfreak:/var/www/owncloud# sudo -u www-data php occ user:resetpassword admin
PHP module intl not installed.
Please ask your server administrator to install the module.


An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/owncloud/lib/private/Console/Application.php:135
Stack trace:
#0 /var/www/owncloud/console.php(105): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/owncloud/occ(11): require_once('/var/www/ownclo…')
#2 {main}root@pcfreak:/var/www/owncloud# apt-cache search php|grep -i intl
php-intl – Internationalisation module for PHP [default]
php-symfony-polyfill-intl-grapheme – Symfony polyfill for intl's grapheme_* functions
php-symfony-polyfill-intl-icu – Symfony polyfill for intl's ICU-related data and classes
php-symfony-polyfill-intl-normalizer – Symfony polyfill for intl's Normalizer class and related functions
php7.0-intl – Internationalisation module for PHP
php-symfony-intl – limited replacement layer for the PHP extension intl
php-symfony-locale – deprecated replacement layer for the PHP extension intl
php5-intl – internationalisation module for php5
root@pcfreak:/var/www/owncloud# apt-get install php7.0-intl
Четене на списъците с пакети… Готово
Изграждане на дървото със зависимости       
Четене на информацията за състоянието… Готово
Следните пакети са били инсталирани автоматично и вече не са необходими:
  docutils-common docutils-doc gcj-4.9-jre-lib gnat-4.9-base libasn1-8-heimdal libavcodec56 libavformat56 libavresample2 libavutil54 libbind9-90 libboost-program-options1.55.0 libboost-python1.55.0 libcompress-raw-bzip2-perl libcompress-raw-zlib-perl libcrypt-openssl-random-perl
  libdnet libdns-export100 libdns100 libegl1-mesa-drivers libexiv2-13 libgcj15 libglew1.10 libgnat-4.9 libgnutls-openssl27 libgphoto2-port10 libgphoto2-port10:i386 libhcrypto4-heimdal libhdb9-heimdal libheimbase1-heimdal libhx509-5-heimdal libimobiledevice4 libinput5 libintl-perl
  libintl-xs-perl libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libjson-c3 libkrb5-26-heimdal libllvm3.5:i386 libllvm3.8 liblognorm1 liblwres90 libntdb1 libopenvg1-mesa libplist2 libprocps3 libpsl0 libroken18-heimdal librrd4 libtfm1
  libusbmuxd2 libvpx1:i386 libwebpdemux1 libwebpdemux2 libwebpmux1 libwind0-heimdal libwings2 libwraster3 libwutil3 libx264-142 libxtables10 linux-image-3.16.0-4-amd64 python-characteristic python-docutils python-ndg-httpsclient python-ntdb python-pil python-pygments
  python-pyinotify python-roman python-twisted-lore python-twisted-mail python-twisted-names python-twisted-news python-twisted-runner python-twisted-words
Използвайте „apt autoremove“ за да ги премахнете.
Следните НОВИ пакети ще бъдат инсталирани:
0 актуализирани, 1 нови инсталирани, 0 за премахване и 1 без промяна.
Необходимо е да се изтеглят 124 kB архиви.
След тази операция ще бъде използвано 523 kB допълнително дисково пространство.
Изт:1 stable/main amd64 php7.0-intl amd64 7.0.30-0+deb9u1 [124 kB]
Изтеглени 124 kB за 1с (93,7 kB/сек)        


Selecting previously unselected package php7.0-intl.
(Reading database … 210111 files and directories currently installed.)
Preparing to unpack …/php7.0-intl_7.0.30-0+deb9u1_amd64.deb …
Unpacking php7.0-intl (7.0.30-0+deb9u1) …
Processing triggers for libapache2-mod-php7.0 (7.0.30-0+deb9u1) …
Setting up php7.0-intl (7.0.30-0+deb9u1) …

Creating config file /etc/php/7.0/mods-available/intl.ini with new version
Processing triggers for libapache2-mod-php7.0 (7.0.30-0+deb9u1) …
root@pcfreak:/var/www/owncloud# occ user:resetpassword admin
bash: occ: командата не е открита
root@pcfreak:/var/www/owncloud# sudo -u www-data php occ user:resetpassword admin
Enter a new password: 
Confirm the new password: 
Successfully reset password for admin



root@pcfreak:/var/www/owncloud# sudo -u www-data php occ user:resetpassword admin
Enter a new password: 
Confirm the new password: 
Successfully reset password for admin


That's all now I can login again to WEB UI interface and use my owncloud-client to synchronize content from my notebook to OwnCloud


This method should work work on resetting password of OwnCloud version 7, 8 and 9 on Linux (Fedora, Ubuntu, CentOS and RHEL) if OwnCoud was installed using rpm / deb packages.