Nextcloud Server Administration Manual
Nextcloud Server Administration Manual
Nextcloud Server Administration Manual
Manual
Release 14
1 Introduction 1
1.1 Videos and blogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Target audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Release notes 3
2.1 Changes in Nextcloud 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Common questions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.3 Theming changes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Installation 5
3.1 System requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 Deployment recommendations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Installation on Linux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.4 Installation wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.5 Installing from command line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6 Installing and managing apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.7 Supported apps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.8 Installing PHP 7.0 on RHEL 7 and CentOS 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.9 SELinux configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.10 Nginx configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4 Server configuration 39
4.1 Warnings on admin page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.2 Using the occ command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.3 Configuring the activity app . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
4.4 Configuring memory caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
4.5 Defining background jobs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.6 Configuration Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
4.7 Email configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.8 Linking external sites . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.9 Language configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
4.10 Logging configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.11 Hardening and security guidance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
4.12 Reverse proxy configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
4.13 Using third party PHP components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
4.14 Automatic configuration setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
4.15 Server tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
4.16 Theming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
4.17 OAuth2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
i
5 User management 121
5.1 User management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.2 Resetting a lost admin password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.3 Resetting a user password . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.4 User password policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.5 Two factor authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.6 User authentication with IMAP, SMB, and FTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.7 User authentication with LDAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5.8 LDAP user cleanup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
5.9 The LDAP configuration API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
5.10 User provisioning API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
10 Maintenance 223
10.1 Backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
10.2 Restoring backup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
10.3 How to upgrade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226
10.4 Upgrade via built-in updater . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
10.5 Upgrade manually . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
10.6 Upgrade via packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
10.7 Migrating to a different server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
10.8 Migrating from ownCloud . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
ii
CHAPTER
ONE
INTRODUCTION
Welcome to the Nextcloud Server Administration Guide. This guide describes administration tasks for Nextcloud, the
flexible open source file synchronization and sharing solution. Nextcloud includes the Nextcloud server, which runs
on Linux, client applications for Microsoft Windows, macOS and Linux, and mobile clients for the Android and Apple
iOS operating systems.
Current editions of Nextcloud manuals are always available online at docs.nextcloud.com.
Nextcloud server is available:
• As a free, full featured community-supported server, with all enterprise features.
• Or with full enterprise support, including phone and email access to Nextcloud developers.
See Release notes for more information on the different Nextcloud editions.
See the official Nextcloud channel on YouTube for tutorials, overviews, and conference videos.
Visit Nextcloud Planet for news and developer blogs.
This guide is for users who want to install, administer, and optimize their Nextcloud servers. To learn more about the
Nextcloud Web user interface, and desktop and mobile clients, please refer to their respective manuals:
• Nextcloud User Manual
• Nextcloud Desktop Client
• Nextcloud Android App
1
Nextcloud Server Administration Manual, Release 14
2 Chapter 1. Introduction
CHAPTER
TWO
RELEASE NOTES
A detailed log of all changes can be found in the official Changelog. There are also all current and previous versions
linked.
• In the Nginx configuration the Same-Origin header was removed. This is now handled in PHP and keep-
ing it will result in a wrong header. Please remove those lines in your Nginx config: add_header
X-Frame-Options "SAMEORIGIN"; See Nginx configuration
• For improvements in serving HTTP requests the Nginx configuration now has HTTP 2 enabled. Please update
your Nginx config accordingly. See Nginx configuration
• The GZip configuration for Nginx was updated. See Nginx configuration for details.
The following error message is shown during the update: “Repair warning: Could not install core app bundle: Could
not download app <app>”.
This basically means that Nextcloud could not fetch the app from the appstore automatically. This could have multiple
reasons: either you disabled the appstore with the config.php flag or your server could not reach the app store. The
instance will work fine, but the features that are usually provided by this app are not available.
With Nextcloud 12, CSS files have been merged into one server.css so in order to keep your theme working you should
consolidate your existing css styles into a server.css file. As for the example theme the styles.css file has been renamed
to server.css.
3
Nextcloud Server Administration Manual, Release 14
THREE
INSTALLATION
3.1.1 Server
For best performance, stability and functionality we have documented some recommendations for running a Nextcloud
server. The Nextcloud server is not compatible with Windows and macOS.
Note: If you plan a setup for your organization and you rely on professional deployment consulting (e.g. efficient
and reliable scaling) and support, we strongly recommend you to check out our **enterprise support**.
Platform Options
Operating System
• Ubuntu 16.04/18.04 LTS (recommended)
• Red Hat Enterprise Linux 7 (recommended)
• Debian 8 (Jessie), 9 (Stretch)
• SUSE Linux Enterprise Server 11 with SP3 & 12
• openSUSE Leap 42.1+
• CentOS 7
Database
• MySQL or MariaDB 5.5+ (recommended)
• Oracle Database 11g (only as part of an enter-
prise subscription)
• PostgreSQL 9/10
• SQLite (only recommended for testing and
minimal-instances)
Webserver
• Apache 2.4 with mod_php or php-fpm (rec-
ommended)
• nginx with php-fpm
PHP Runtime
• 7.0
• 7.1
• 7.2
See Installation on Linux for minimum PHP-modules and additional software for installing Nextcloud.
5
Nextcloud Server Administration Manual, Release 14
Memory
Memory requirements for running an Nextcloud server are greatly variable, depending on the numbers of users, apps,
files and volume of server activity.
Nextcloud needs a minimum of 128MB RAM, and we recommend a minimum of 512MB.
The following is currently required if you’re running Nextcloud together with a MySQL / MariaDB database:
• InnoDB storage engine (MyISAM is not supported)
• “READ COMMITED” transaction isolation level (See: Database “READ COMMITTED” transaction isolation
level)
• Disabled or BINLOG_FORMAT = ROW configured Binary Logging (See: https://dev.mysql.com/doc/refman/
5.7/en/binary-log-formats.html)
• For Emoji (UTF8 4-byte) support see Enabling MySQL 4-byte support
We strongly recommend using the latest version of your operating system to get the full and most stable experience
out of our clients.
• Windows 7+
• macOS Lion (10.7)+ (64-bit only)
• Linux (CentOS 6.5+, Ubuntu 14.04+, Fedora 21+, openSUSE 13, SUSE Linux Enterprise 11 SP3+, Debian 8
(Jessie)+, Red Hat Enterprise Linux 7)
We strongly recommend using the latest version of your mobile operating system to get the full and most stable
experience out of our mobile apps.
• iOS 9.x+
• Android 4.x+
Note: The separate Nextcloud Talk app requires iOS 9.x+ or Android 5.x+.
For the best experience with the Nextcloud web interface, we recommend that you use the latest and supported version
of a browser from this list, or one based on those:
• Microsoft Internet Explorer 11 (latest version)
• Microsoft Edge
• Mozilla Firefox
• Google Chrome/Chromium
6 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
• Apple Safari
Note: If you want to use Nextcloud Talk you should use Mozilla Firefox 52+ or Google Chrome/Chromium 49+ to
have the full experience with video calls and screensharing. Google Chrome/Chromium requires a additional plugin
for screensharing.
If there are no packages for your Linux distribution, you have the option to install Snap Packages. See Installing via
Snap packages
In case you prefer installing from the source tarball, you can setup Nextcloud from scratch using a classic LAMP stack
(Linux, Apache, MySQL/MariaDB, PHP). This document provides a complete walk-through for installing Nextcloud
on Ubuntu 16.04 LTS Server with Apache and MariaDB, using the Nextcloud .tar archive.
• Installing on Windows (virtual machine)
• Installing via Snap packages
• Prerequisites for manual installation
• Example installation on Ubuntu 16.04 LTS server
• Example installation on CentOS 7 server
• Apache Web server configuration
• Pretty URLs
• Enabling SSL
• Installation wizard
• SELinux configuration tips
• php.ini configuration notes
• php-fpm configuration notes
• Other Web servers
Note: Admins of SELinux-enabled distributions such as CentOS, Fedora, and Red Hat Enterprise Linux may need to
set new rules to enable installing Nextcloud. See SELinux configuration tips for a suggested configuration.
If you are using Windows, the easiest way to get Nextcloud up and running is using a virtual machine (VM). There
are two options:
• Enterprise/SMB appliance
Nextcloud GmbH maintains a free appliance built on the Univention Corporate Server (UCS) with easy graphical
setup and web-based administration. It includes user management via LDAP, can replace an existing Active Directory
setup and has optional ONLYOFFICE and Collabora Online integration, with many more applications available for
easy and quick install.
It can be installed on hardware or ran in a virtual machine using VirtualBox, VMWare (ESX) and KVM images.
Download the the Appliance here:
• Univention Corporate Server (UCS)
• Home user/SMB appliance
A ‘community VM <https://github.com/nextcloud/vm >‘_ is maintained by T&M Hansson IT and several different
versions are offered. The main version is for VMware version 10 and it comes in different sizes. The standard size
is 40 GB but you can also download a 500 GB, 1 TB, or a 2 TB version. T&M Hansson IT also provides a Hyper-V
version for Hyper-V users.
For complete instructions and downloads see:
• https://github.com/nextcloud/vm
• https://www.hanssonit.se/nextcloud-vm/
Note: You can install the VM on OSes other than Windows as long as your hypervisor can mount OVA, VMDK, or
VHD/VHDX VM formats.
A snap is a zip file containing an application together with its dependencies, and a description of how it should safely be
run on your system, especially the different ways it should talk to other software. Most importantly snaps are designed
to be secure, sandboxed, containerized applications isolated from the underlying system and from other applications.
To install the Nextcloud Snap Package, run the following command in a terminal:
Note: The snapd technology is the core that powers snaps, and it offers a new way to package, distribute, update and
run OS components and applications on a Linux system. See more about snaps on snapcraft.io.
The Nextcloud .tar archive contains all of the required PHP modules. This section lists all required and optional PHP
modules. Consult the PHP manual for more information on modules. Your Linux distribution should have packages for
all required modules. You can check the presence of a module by typing php -m | grep -i <module_name>.
If you get a result, the module is present.
Required:
• PHP (>= 7.0, 7.1 or 7.2)
• PHP module ctype
• PHP module dom
• PHP module GD
8 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
On a machine running a pristine Ubuntu 16.04 LTS server, you have two options:
You can either install the Nextcloud Snap Package, just run the following command in a terminal:
Or you can use .deb packages to install the required and recommended modules for a typical Nextcloud installation,
using Apache and MariaDB, by issuing the following commands in a terminal:
• This installs the packages for the Nextcloud core system. libapache2-mod-php7.0 provides the fol-
lowing PHP extensions: bcmath bz2 calendar Core ctype date dba dom ereg exif
fileinfo filter ftp gettext hash iconv libxml mhash openssl pcre Phar
posix Reflection session shmop SimpleXML soap sockets SPL standard sysvmsg
sysvsem sysvshm tokenizer wddx xmlreader xmlwriter zlib. If you are planning on
running additional apps, keep in mind that they might require additional packages. See Prerequisites for manual
installation for details.
• At the installation of the MySQL/MariaDB server, you will be prompted to create a root password. Be sure to
remember your password as you will need it during Nextcloud database setup.
Now download the archive of the latest Nextcloud version:
• Go to the Nextcloud Download Page.
• Go to Download Nextcloud Server > Download > Archive file for server owners and download either the
tar.bz2 or .zip archive.
• This downloads a file named nextcloud-x.y.z.tar.bz2 or nextcloud-x.y.z.zip (where x.y.z is the version number).
• Download its corresponding checksum file, e.g. nextcloud-x.y.z.tar.bz2.md5, or nextcloud-x.y.z.tar.bz2.sha256.
• Verify the MD5 or SHA256 sum:
10 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
wget https://download.nextcloud.com/server/releases/nextcloud-x.y.z.tar.bz2.asc
wget https://nextcloud.com/nextcloud.asc
gpg --import nextcloud.asc
gpg --verify nextcloud-x.y.z.tar.bz2.asc nextcloud-x.y.z.tar.bz2
• Now you can extract the archive contents. Run the appropriate unpacking command for your archive type:
tar -xjf nextcloud-x.y.z.tar.bz2
unzip nextcloud-x.y.z.zip
• This unpacks to a single nextcloud directory. Copy the Nextcloud directory to its final destination. When
you are running the Apache HTTP server you may safely install Nextcloud in your Apache document root:
cp -r nextcloud /path/to/webserver/document-root
On other HTTP servers it is recommended to install Nextcloud outside of the document root.
In this install tutorial we will be deploying CentOS 7.5, PHP 7.2, MariaDB, Redis as memcache and Nextcloud running
on Apache.
Start off by installing a CentOS 7 minimal install. This should provide a sufficient platform to run a successful
Nextcloud instance.
First install some dependencies you will be needing during installation, but which will also be useful in every day use
situations:
yum install -y epel-release yum-utils unzip curl wget \
bash-completion policycoreutils-python mlocate bzip2
Apache:
yum install -y httpd
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName your.server.com
<Directory "/var/www/html/">
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
</VirtualHost>
PHP:
Next install the PHP modules needed for this install. Remember, because this is a limited basic install, we only install
the neccessary modules, not all of them. If you are making a more complete install, please refer to PHP module list at
the top of this page.:
Database
As mentioned, we will be using MySQL/MariaDB as our database.:
There is already an extensive document on database configuration which you can find here: ..ad-
min_manual/configuration_server/automatic_configuration.rst Please follow all instructions there and then head back
here.
Installing Nextcloud
Nearly there, so keep at it, you are doing great!
Now download the archive of the latest Nextcloud version:
• Go to the Nextcloud Download Page.
• Go to Download Nextcloud Server > Download > Archive file for server owners and download either the
tar.bz2 or .zip archive.
• This downloads a file named nextcloud-x.y.z.tar.bz2 or nextcloud-x.y.z.zip (where x.y.z is the version number).
• Download its corresponding checksum file, e.g. nextcloud-x.y.z.tar.bz2.md5, or nextcloud-x.y.z.tar.bz2.sha256.
• Verify the MD5 or SHA256 sum:
wget https://download.nextcloud.com/server/releases/nextcloud-x.y.z.tar.bz2.asc
wget https://nextcloud.com/nextcloud.asc
gpg --import nextcloud.asc
gpg --verify nextcloud-x.y.z.tar.bz2.asc nextcloud-x.y.z.tar.bz2
12 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
For the sake of the walk-through, we grabbed the latest version of Nextcloud in the form a zip file, confirmed the
download with the above-mentioned command, and now we will extract it:
unzip nextcloud-*.zip
Copy the content over to the root directory of your webserver. In our case, we are using apache so it will be /var/
www/html/:
cp -R nextcloud/ /var/www/html/
During the install process, no data folder is created, so we will create one manually to help with the installation wizard:
mkdir /var/www/html/nextcloud/data
Make sure that apache has read and write access to the whole nextcloud folder:
Restart apache:
Redis:
SELinux
Again, there is an extensive write-up done on SELinux which can be found at SELinux configuration, so if you are
using SELinux in Enforcing mode, please run the commands suggested on that page. The following commands only
refers to this tutorial:
restorecon -R '/var/www/html/nextcloud/'
setsebool -P httpd_can_network_connect on
If you need more SELinux configs, refer to the above-mentioned URL, return to this tutorial.
Once done with with SELinux, please head over to http://your.server.com/nextcloud and follow the
steps as found Installation wizard, where it will explain to you exactly how to proceed with the final part of the install,
which is done as admin user through your web browser.
Note: If you use this tutorial, and you see warnings in the web browser after installation about OPcache not being
enabled or configured correctly, you need to make the suggested changes in /etc/php.d/opcache.ini for the
errors to disappear. These warnings will be on the Admin page, under Basic settings.
Because we used Redis as a memcache, you will need a config similar to the following example in /var/www/
html/nextcloud/config/config.php which is auto-generated when you run the online installation wizard
mentioned earlier.
Example config:
Remember, this tutorial is only for a basic setup of Nextcloud on CentOS 7, with PHP 7.2. If you are going to use
more features like LDAP or Single Sign On, you will need additional PHP modules as well as extra configurations. So
please visit the rest of the Admin manual, ..admin_manual/index.rst, for detailed descriptions on how to get this done.
On Debian, Ubuntu, and their derivatives, Apache installs with a useful configuration so all you have to do is create
a /etc/apache2/sites-available/nextcloud.conf file with these lines in it, replacing the Directory
and other filepaths with your own filepaths:
<Directory /var/www/nextcloud/>
Options +FollowSymlinks
AllowOverride All
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
a2ensite nextcloud.conf
• For Nextcloud to work correctly, we need the module mod_rewrite. Enable it by running:
a2enmod rewrite
14 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime
a2enmod setenvif
• You must disable any server-configured authentication for Nextcloud, as it uses Basic authentication internally
for DAV services. If you have turned on authentication on a parent folder (via e.g. an AuthType Basic
directive), you can turn off the authentication specifically for the Nextcloud entry. Following the above example
configuration file, add the following line in the <Directory> section:
Satisfy Any
• When using SSL, take special note of the ServerName. You should specify one in the server configuration, as
well as in the CommonName field of the certificate. If you want your Nextcloud to be reachable via the internet,
then set both of these to the domain you want to reach your Nextcloud server.
• Now restart Apache:
• If you’re running Nextcloud in a subdirectory and want to use CalDAV or CardDAV clients make sure you have
configured the correct Service discovery URLs.
Pretty URLs remove the index.php-part in all Nextcloud URLs, for example in sharing links like https://
example.org/nextcloud/index.php/s/Sv1b7krAUqmF8QQ, making URLs shorter and thus prettier.
mod_env and mod_rewrite must be installed on your webserver and the .htaccess must be writable by the
HTTP user. Then you can set in the config.php two variables:
if it isn’t installed in a subfolder. Finally run this occ-command to update your .htaccess file:
After each update, these changes are automatically applied to the .htaccess-file.
Note: You can use Nextcloud over plain HTTP, but we strongly encourage you to use SSL/TLS to encrypt all of your
server traffic, and to protect user’s logins and data in transit.
Apache installed under Ubuntu comes already set-up with a simple self-signed certificate. All you have to do is to
enable the ssl module and the default site. Open a terminal and run:
a2enmod ssl
a2ensite default-ssl
service apache2 reload
Note: Self-signed certificates have their drawbacks - especially when you plan to make your Nextcloud server publicly
accessible. You might want to consider getting a certificate signed by a commercial signing authority. Check with
your domain name registrar or hosting service for good deals on commercial certificates.
After restarting Apache you must complete your installation by running either the graphical Installation Wizard, or
on the command line with the occ command. To enable this, change the ownership on your Nextcloud directories to
your HTTP user:
chown -R www-data:www-data /var/www/nextcloud/
Note: Admins of SELinux-enabled distributions may need to write new SELinux rules to complete their Nextcloud
installation; see SELinux configuration tips.
See SELinux configuration for a suggested configuration for SELinux-enabled distributions such as Fedora and Cen-
tOS.
Keep in mind that changes to php.ini may have to be configured on more than one ini file. This can be the case, for
example, for the date.timezone setting.
php.ini - used by the Web server:
/etc/php5/apache2/php.ini
or
/etc/php5/fpm/php.ini
or ...
16 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
/etc/php5/cli/php.ini
In both examples, the ini/config file is called www.conf, and depending on the distro version or customizations you
have made, it may be in a subdirectory such as pool.d.
Usually, you will find some or all of the environment variables already in the file, but commented out like this:
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
Uncomment the appropriate existing entries. Then run printenv PATH to confirm your paths, for example:
$ printenv PATH
/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:
/sbin:/bin:/
If any of your system environment variables are not present in the file then you must add them.
Alternatively it is possible to use the environemt variables of your system by modifying
/etc/php/7.0/fpm/pool.d/www.conf
and uncommenting the line
clear_env = no
When you are using shared hosting or a control panel to manage your Nextcloud VM or server, the configuration files
are almost certain to be located somewhere else, for security and flexibility reasons, so check your documentation for
the correct locations.
Please keep in mind that it is possible to create different settings for php-cli and php-fpm, and for different
domains and Web sites. The best way to check your settings is with PHP version and information.
Maximum upload size
If you want to increase the maximum upload size, you will also have to modify your php-fpm configuration and
increase the upload_max_filesize and post_max_size values. You will need to restart php5-fpm and
your HTTP server in order for these changes to be applied.
.htaccess notes for Apache
Nextcloud comes with its own nextcloud/.htaccess file. Because php-fpm can’t read PHP settings in .
htaccess these settings and permissions must be set in the nextcloud/.user.ini file.
Nginx configuration
Other HTTP servers (Nextcloud)
When Nextcloud prerequisites are fulfilled and all Nextcloud files are installed, the last step to completing the instal-
lation is running the Installation Wizard. This is just three steps:
1. Point your Web browser to http://localhost/nextcloud
2. Enter your desired administrator’s username and password.
3. Click Finish Setup.
18 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
You’re finished and can start using your new Nextcloud server.
Of course, there is much more that you can do to set up your Nextcloud server for best performance and security. In
the following sections we will cover important installation and post-installation steps.
• Data Directory Location
• Database Choice
• Trusted Domains
Click Storage and Database to expose additional installation configuration options for your Nextcloud data directory
and database.
You should locate your Nextcloud data directory outside of your Web root if you are using an HTTP server other than
Apache, or you may wish to store your Nextcloud data in a different location for other reasons (e.g. on a storage
server). It is best to configure your data directory location at installation, as it is difficult to move after installation.
You may put it anywhere; in this example is it located in /opt/nextcloud/. This directory must already exist,
and must be owned by your HTTP user.
SQLite is the default database for Nextcloud Server and it is good only for testing and lightweight single-user setups
without client synchronization. Supported databases are MySQL, MariaDB, Oracle 11g, and PostgreSQL, and we
recommend MySQL/MariaDB. Your database and PHP connectors must be installed before you run the Installation
Wizard. When you install Nextcloud from packages all the necessary dependencies will be satisfied (see Installation
on Linux for a detailed listing of required and optional PHP modules). You will need the root database login, or any
20 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
administrator login that has permissions to create and modify databases, and then enter any name you want for your
Nextcloud database.
After you enter your root or administrator login for your database, the installer creates a special database user with
privileges limited to the Nextcloud database. Then Nextcloud needs only the special Nextcloud database user, and
drops the root dB login. This user is named for your Nextcloud admin user, with an oc_ prefix, and then given a
random password. The Nextcloud database user and password are written into config.php:
Click Finish Setup, and start using your new Nextcloud server.
All URLs used to access your Nextcloud server must be whitelisted in your config.php file, under the
trusted_domains setting. Users are allowed to log into Nextcloud only when they point their browsers to a
URL that is listed in the trusted_domains setting. You may use IP addresses and domain names. A typical
configuration looks like this:
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'server1.example.com',
2 => '192.168.1.50',
),
The loopback address, 127.0.0.1, is automatically whitelisted, so as long as you have access to the physical server
you can always log in. In the event that a load balancer is in place there will be no issues as long as it sends the correct
X-Forwarded-Host header. When a user tries a URL that is not whitelisted the following error appears:
It is now possible to install Nextcloud entirely from the command line. This is convenient for scripted operations,
headless servers, and sysadmins who prefer the command line. There are three stages to installing Nextcloud via the
command line:
1. Download the Nextcloud code and unpack the tarball in the appropriate directories. (See Installation on Linux.)
2. Change the ownership of your nextcloud directory to your HTTP user, like this example for Debian/Ubuntu.
You must run occ as your HTTP user; see Run occ as your HTTP user:
3. Use the occ command to complete your installation. This takes the place of running the graphical Installation
Wizard:
$ cd /var/www/nextcloud/
$ sudo -u www-data php occ maintenance:install --database
"mysql" --database-name "nextcloud" --database-user "root" --database-pass
"password" --admin-user "admin" --admin-pass "password"
Nextcloud is not installed - only a limited number of commands are available
Nextcloud was successfully installed
Note that you must change to the root Nextcloud directory, as in the example above, to run occ
maintenance:install, or the installation will fail with a PHP fatal error message.
22 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
Nextcloud apps can enhance, customize or even restrict the features and experience you and your users has with the
Nextcloud server. Next to default enabled functions like Files, Activity and Gallery there are other apps like Calendar,
Contacts, Talk and more which are enhancing the features of your Nextcloud server.
After installing the Nextcloud server, you might want to consider about enabling, disabling or even restricting some
apps to groups depending on your and your users needs.
During the Nextcloud server installation, some apps are enabled by default. To see which apps are enabled go to your
Apps page.
Those apps are supported and developed by Nextcloud GmbH directly and have an Official-tag. See Supported apps
for a list of supported apps.
Note: To get access to work-arounds, long-term-support, priority bug fixing and custom consulting for supported
apps, contact our sales team.
Apps with Approved tag are community-developed and were uploaded in the Nextcloud App Store.
Note: If you would like to develop your own Nextcloud app, you can find out more information in our developer
manual.
You will see which apps are enabled, disabled and available. You’ll also see additional app bundles and filters, such as
Customization, Security and Monitoring for finding more apps quickly.
In the Apps page you can enable or disable applications. Some apps have configurable options on the Apps page,
such as Enable only for specific groups, but mainly they are enabled or disabled here, and are configured in your
Nextcloud settings (admin and/or user-settings) or in the config.php.
Click the app name to view a description of the app and any of the app settings in the Application View field. Clicking
the Enable button will enable the app. If the app is not part of the Nextcloud installation, it will be downloaded from
the app store, installed and enabled.
24 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
If private API, rather than the public APIs are used in a third-party app, the installation fails, if 'appcodechecker'
=> true, is set in config.php.
Use the apps_paths array in config.php to set any custom apps directory locations. The key path defines the
absolute file system path to the app folder. The key url defines the HTTP web path to that folder, starting at the
Nextcloud web root. The key writable indicates if a user can install apps in that folder.
Note: To ensure that the default /apps/ folder only contains apps shipped with Nextcloud, follow this example to
setup an /apps2/ folder which will be used to store all other apps.
<?php
You can enable the installation of apps from your own apps store. This requires that you can write to at least one of
the configured apps directories.
To enable installation from your own apps store:
1. Set the appstoreenabled parameter to “true”.
This parameter is used to enable your apps store in Nextcloud.
2. Set the appstoreurl to the URL of your Nextcloud apps store.
This parameter is used to set the http path to the Nextcloud apps store. The appstore server must use OCS (Open
Collaboration Services).
<?php
Below is the list of apps supported for Nextcloud 14. Supported here means that we’ll accept bugreports and resolve
them in these apps with regard to functionality and compatibility with Nextcloud 14. To get access to work-arounds,
long term support, priority bug fixing and custom consulting, contact Nextcloud GmbH.
• Activity
• Admin Audit Log
• AntiVirus
• Calendar
• Circles
• Collaborative Tags
• Comments
• Contacts
• Encryption
• External Sites
• Federated File Sharing (allows file sharing across Nextcloud instances)
• Federation (allows usernname auto-complete across Nextcloud instances)
• Files (cannot be disabled)
• Files Access Control
• Files Automated Tagging
• Files External (external storage)
• Files PDF Viewer
• Files Sharing
• Files Text Editor
• Files Trashbin
• Files Versions
• Files Video Player
• First Run Wizard
• Gallery
• Logreader
• Lookup Server Connector
• Nextcloud Announcements
• Notifications
• Object Storage (Swift)
• Password Policy
• Provisioning API
• Server info (monitoring app)
26 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
• Sharebymail
• Socialsharing (Diaspora, email, Facebook, Google+ and Twitter)
• Sharepoint (external storage)
• Template Editor (for notification emails)
• Theming
• Update Notifications
• User External
• User LDAP
• User Shibboleth/SAML
• Talk
• WebDAV Endpoint (handles old and new webdav endpoints)
• Workflow Engine (cannot be disabled)
All apps are licensed under the AGPL.
PHP 5.4 has been end-of-life since September 2015 and is no longer supported by the PHP team. RHEL 7 still ships
with PHP 5.4, and Red Hat supports it. Nextcloud 14+ requires PHP 7.0 or newer, so upgrading to 7.0 is required.
To upgrade to PHP 7.0, you must use the Software Collections (SCL) repository to be in compliance with your RHEL
support contract, and not any other third-party repository. Follow these steps to install PHP 7.0 from SCL. First you
must use your Subscription Manager to enable SCL:
You must also install the updated database module for your database. This installs the new PHP 7.0 module for
MySQL/MariaDB:
If you are using the Nextcloud LDAP app, you need this module:
Disable loading the old PHP Apache modules by changing their names:
mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php54.off
mv /etc/httpd/conf.modules.d/10-php.conf /etc/httpd/conf.modules.d/10-php54.off
ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php70-php.conf /etc/httpd/conf.d/
ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php70-php.conf /etc/httpd/
˓→conf.modules.d/
ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php70-php7.so /etc/httpd/modules/
Verify with phpinfo that your Apache server is using PHP 7.0 and loading the correct modules; see PHP version
and information to learn how to use phpinfo.
To upgrade to PHP 7.0, use the Red Hat Software Collections (SCL) repository.
Follow these steps to install PHP 7.0 from SCL. First install the SCL repository:
You must also install the updated database module for your database. This installs the new PHP 7.0 module for
MySQL/MariaDB:
If you are using the Nextcloud LDAP app, you need this module:
Disable loading the old PHP Apache modules by changing their names:
mv /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php54.off
mv /etc/httpd/conf.modules.d/10-php.conf /etc/httpd/conf.modules.d/10-php54.off
ln -s /opt/rh/httpd24/root/etc/httpd/conf.d/rh-php70-php.conf /etc/httpd/conf.d/
ln -s /opt/rh/httpd24/root/etc/httpd/conf.modules.d/15-rh-php70-php.conf /etc/httpd/
˓→conf.modules.d/
ln -s /opt/rh/httpd24/root/etc/httpd/modules/librh-php70-php7.so /etc/httpd/modules/
Verify with phpinfo that your Apache server is using PHP 7.0 and loading the correct modules; see PHP version
and information to learn how to use phpinfo.
28 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
When you have SELinux enabled on your Linux distribution, you may run into permissions problems after a new
Nextcloud installation, and see permission denied errors in your Nextcloud logs.
The following settings should work for most SELinux systems that use the default distro profiles. Run these commands
as root, and remember to adjust the filepaths in these examples for your installation:
If you uninstall Nextcloud you need to remove the Nextcloud directory labels. To do this execute the following
commands as root after uninstalling Nextcloud:
If you have customized SELinux policies and these examples do not work, you must give the HTTP server write access
to these directories:
/var/www/html/nextcloud/data
/var/www/html/nextcloud/config
/var/www/html/nextcloud/apps
To enable updates via the web interface, you may need this to enable writing to the directories:
setsebool httpd_unified on
For security reasons it’s suggested to disable write access to all folders in /var/www/ (default):
setsebool -P httpd_can_network_connect_db on
setsebool -P httpd_can_connect_ldap on
Nextcloud requires access to remote networks for functions such as Server-to-Server sharing, external storages or the
app store. To allow this access use the following setting:
setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_memcache on
If you want to allow Nextcloud to send out e-mail notifications via sendmail you need to use the following setting:
setsebool -P httpd_can_sendmail on
If you have placed your datadir on a CIFS/SMB share use the following setting:
setsebool -P httpd_use_cifs on
If your data folder resides on a Fuse Filesystem (e.g. EncFS etc), this setting is required as well:
setsebool -P httpd_use_fusefs on
30 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
If you use a the rainloop webmail client app which supports GPG/PGP, you might need this:
setsebool -P httpd_use_gpg on
3.9.11 Troubleshooting
For general Troubleshooting of SELinux and its profiles try to install the package setroubleshoot and run:
It is much stronger security to have a more fine-grained ruleset as in the examples at the beginning, so use this only
for testing and troubleshooting. It has a similar effect to disabling SELinux, so don’t use it on production systems.
This page covers example Nginx configurations to use with running an Nextcloud server. This page is community-
maintained. (Thank you, contributors!)
• You need to insert the following code into your Nginx configuration file.
• Adjust server_name, root, ssl_certificate and ssl_certificate_key to suit your needs.
• Make sure your SSL certificates are readable by the server (see nginx HTTP SSL Module documentation).
• add_header statements are only taken from the current level and are not cascaded from or to a different
level. All necessary add_header statements must be defined in each level needed. For better readability it
is possible to move common add header statements into a separate file and include that file wherever necessary.
However, each add_header statement must be written in a single line to prevent connection problems with
sync clients.
• Be careful about line breaks if you copy the examples, as long lines may be broken for page formatting.
• Some environments might need a cgi.fix_pathinfo set to 1 in their php.ini.
Thanks to @josh4trunks for providing / creating these configuration examples.
The following configuration should be used when Nextcloud is placed in the webroot of your nginx installation. In
this example it is /var/www/nextcloud and it is accessed via http(s)://cloud.example.com
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php/php7.0-fpm.sock;
}
server {
listen 80;
listen [::]:80;
server_name cloud.example.com;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.example.com;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json
# last;
location = /.well-known/carddav {
return 301 $scheme://$host/remote.php/dav;
}
32 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
location = /.well-known/caldav {
return 301 $scheme://$host/remote.php/dav;
}
location / {
rewrite ^ /index.php$request_uri;
}
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/
˓→ v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
location ~ \.(?:css|js|woff2?|svg|gif)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read into
# this topic first.
# add_header Strict-Transport-Security "max-age=15768000; includeSubDomains;
˓→preload;";
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;
add_header X-Download-Options noopen;
add_header X-Permitted-Cross-Domain-Policies none;
add_header Referrer-Policy no-referrer;
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
}
The following config should be used when Nextcloud is placed within a subdir of your nginx installation.
upstream php-handler {
server 127.0.0.1:9000;
#server unix:/var/run/php/php7.0-fpm.sock;
}
server {
listen 80;
listen [::]:80;
server_name cloud.example.com;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name cloud.example.com;
34 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
# https://mozilla.github.io/server-side-tls/ssl-config-generator/
# NOTE: some settings below might be redundant
ssl_certificate /etc/ssl/nginx/cloud.example.com.crt;
ssl_certificate_key /etc/ssl/nginx/cloud.example.com.key;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
# rewrite ^/.well-known/host-meta /nextcloud/public.php?service=host-meta
# last;
#rewrite ^/.well-known/host-meta.json
# /nextcloud/public.php?service=host-meta-json last;
location = /.well-known/carddav {
return 301 $scheme://$host/nextcloud/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $scheme://$host/nextcloud/remote.php/dav;
}
location /.well-known/acme-challenge { }
location ^~ /nextcloud {
location /nextcloud {
rewrite ^ /nextcloud/index.php$request_uri;
}
location ~ ^/nextcloud/(?:build|tests|config|lib|3rdparty|templates|data)/ {
deny all;
}
location ~ ^/nextcloud/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^/nextcloud/(?:index|remote|public|cron|core/ajax/
˓→ update|status|ocs/v[12]|updater/.+|ocs-provider/.+)\.php(?:$|/) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/nextcloud/(?:updater|ocs-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}
36 Chapter 3. Installation
Nextcloud Server Administration Manual, Release 14
location ~ \.(?:png|html|ttf|ico|jpg|jpeg)$ {
try_files $uri /nextcloud/index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
}
}
If you’re seeing meaningless messages in your logfile, for example client denied by server
configuration: /var/www/data/htaccesstest.txt, add this section to your nginx configuration to
suppress them:
location = /data/htaccesstest.txt {
allow all;
log_not_found off;
access_log off;
}
A common issue with custom nginx configs is that JavaScript (.js) or CSS (.css) files are not served properly leading
to a 404 (File not found) error on those files and a broken webinterface.
This could be caused by the:
location ~* \.(?:css|js)$ {
location ~ \.php(?:$|/) {
block. Other custom configurations like caching JavaScript (.js) or CSS (.css) files via gzip could also cause such
issues.
38 Chapter 3. Installation
CHAPTER
FOUR
SERVER CONFIGURATION
Your Nextcloud server has a built-in configuration checker, and it reports its findings at the top of your Admin page.
These are some of the warnings you might see, and what to do about them.
You can use the Nextcloud Security Scan to see if your system is up to date and well secured. We have ran this scan
over public IP addresses in the past to try and reach out to extremely outdated systems and might again in the future.
Please, protect your privacy and keep your server up to date! Privacy means little without security.
“No memory cache has been configured. To enhance your performance please configure a memcache if available.”
Nextcloud supports multiple php caching extensions:
• APCu (minimum required PHP extension version 4.0.6)
• Memcached
• Redis (minimum required PHP extension version: 2.2.6)
You will see this warning if you have no caches installed and enabled, or if your cache does not have the required
minimum version installed; older versions are disabled because of performance problems.
If you see “{Cache} below version {Version} is installed. for stability and performance reasons we recommend to
update to a newer {Cache} version” then you need to upgrade, or, if you’re not using it, remove it.
You are not required to use any caches, but caches improve server performance. See Configuring memory caching.
39
Nextcloud Server Administration Manual, Release 14
“Transactional file locking is disabled, this might lead to issues with race conditions.”
Please see Transactional file locking on how to correctly configure your environment for transactional file locking.
“You are accessing this site via HTTP. We strongly suggest you configure your server to require using HTTPS instead.”
Please take this warning seriously; using HTTPS is a fundamental security measure. You must configure your Web
server to support it, and then there are some settings in the Security section of your Nextcloud Admin page to enable.
The following pages describe how to enable HTTPS on the Apache and Nginx Web servers.
Enabling SSL (on Apache)
Use HTTPS
Nginx configuration
Some environments are not passing a valid PATH variable to Nextcloud. The php-fpm configuration notes provides
the information about how to configure your environment.
“The “Strict-Transport-Security” HTTP header is not configured to least “15552000” seconds. For enhanced security
we recommend enabling HSTS as described in our security tips.”
The HSTS header needs to be configured within your Web server by following the Enable HTTP Strict Transport
Security documentation
“/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be
found in our documentation.”
This message is another one which needs to be taken seriously. Please have a look at the Give PHP read access to
/dev/urandom documentation.
4.1.7 Your Web server is not yet set up properly to allow file synchronization
“Your web server is not yet set up properly to allow file synchronization because the WebDAV interface seems to be
broken.”
At the ownCloud community forums a larger FAQ is maintained containing various information and debugging hints.
“cURL is using an outdated OpenSSL version (OpenSSL/$version). Please update your operating system or features
such as installing and updating apps via the app store or Federated Cloud Sharing will not work reliably.”
“cURL is using an outdated NSS version (NSS/$version). Please update your operating system or features such as
installing and updating apps via the app store or Federated Cloud Sharing will not work reliably.”
There are known bugs in older OpenSSL and NSS versions leading to misbehavior in combination with remote hosts
using SNI. A technology used by most of the HTTPS websites. To ensure that Nextcloud will work properly you
need to update OpenSSL to at least 1.0.2b or 1.0.1d. For NSS the patch version depends on your distribution and an
heuristic is running the test which actually reproduces the bug. There are distributions such as RHEL/CentOS which
have this backport still pending.
Both URLs need to be correctly redirected to the DAV endpoint of Nextcloud. Please refer to Service discovery for
more info.
Please refer to the Fixing invalid code integrity messages documentation how to debug this issue.
4.1.11 Your database does not run with “READ COMMITED” transaction isolation
level
“Your database does not run with “READ COMMITED” transaction isolation level. This can cause problems when
multiple actions are executed in parallel.”
Please refer to Database “READ COMMITTED” transaction isolation level how to configure your database for this
requirement.
Nextcloud’s occ command (origins from “ownCloud Console”) is Nextcloud’s command-line interface. You can
perform many common server operations with occ, such as installing and upgrading Nextcloud, manage users, en-
cryption, passwords, LDAP setting, and more.
occ is in the nextcloud/ directory; for example /var/www/nextcloud on Ubuntu Linux. occ is a PHP script.
You must run it as your HTTP user to ensure that the correct permissions are maintained on your Nextcloud files
and directories.
• Dav commands
• Database conversion
• Add missing indices
• Encryption
• Federation sync
• File operations
• Files external
• Integrity check
• l10n, create JavaScript translation files for apps
• LDAP commands
• Logging commands
• Maintenance commands
• Security
• Trashbin
• User commands
• _group_commands_label
• Versions
• Command line installation
• Command line upgrade
• Two-factor authentication
• Disable users
Note: Although the following examples make use of the sudo -u ... /path/to/php /path/to/occ
method, your environment may require use of a different wrapper utility than sudo to execute the command as the
appropriate user. Other common wrappers:
• su --command '/path/to/php ...' username – Note here that the target user specification comes
at the end, and the command to execute is specified first.
• runuser --user username -- /path/to/php ... – This wrapper might be used in container con-
texts (ex: Docker / arm32v7/nextcloud) where both sudo and su wrapper utilities cannot be used.
Running occ with no options lists all commands and options, like this example on Ubuntu:
sudo -u www-data php occ
Nextcloud version 9.0.0
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--no-warnings Skip global warnings, show command output only
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output,
2 for more verbose output and 3 for debug
Available commands:
check check dependencies of the server
environment
help Displays help for a command
list Lists commands
status show some status information
upgrade run upgrade routines after installation of
a new release. The release has to be
installed before.
occ has options, commands, and arguments. Options and arguments are optional, while commands are required. The
syntax is:
occ [options] command [arguments]
Get detailed information on individual commands with the help command, like this example for the
maintenance:mode command:
Options:
--on enable maintenance mode
--off disable maintenance mode
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--no-warnings Skip global warnings, show command output only
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output,
2 for more verbose output and 3 for debug
The status command from above has an option to define the output format. The default is plain text, but it can also
be json:
or json_pretty:
This output option is available on all list and list-like commands: status, check, app:list, config:list,
encryption:status and encryption:list-modules
Note: Command autocompletion currently only works if the user you use to execute the occ commands has a profile.
www-data in most cases is nologon and therefor cannot use this feature.
Since Nextcloud 11 autocompletion is available for bash (and bash based consoles). To enable it, you have to run one
of the following commands:
This will allow you to use autocompletion with the full path /var/www/html/nextcloud/occ <tab>.
If you also want to use autocompletion on occ from within the directory without using the full path, you need to specify
--program occ after the --generate-hook.
If you want the completion to apply automatically for all new shell sessions, add the command to your shell’s profile
(eg. ~/.bash_profile or ~/.zshrc).
app
app:install install selected app
app:check-code check code to be compliant
app:disable disable an app
app:enable enable an app
app:getpath Get an absolute path to the app directory
app:list List all available apps
List all of your installed apps, and show whether they are enabled or disabled:
Disable an app:
app:check-code has multiple checks: it checks if an app uses Nextcloud’s public API (OCP) or private API (OC_),
and it also checks for deprecated methods and the validity of the info.xml file. By default all checks are enabled.
The Activity app is an example of a correctly-formatted app:
Use the background command to select which scheduler you want to use for controlling background jobs, Ajax,
Webcron, or Cron. This is the same as using the Cron section on your Nextcloud Admin page:
background
background:ajax Use ajax to run background jobs
background:cron Use cron to run background jobs
background:webcron Use webcron to run background jobs
config
config:app:delete Delete an app config value
config:app:get Get an app config value
config:app:set Set an app config value
config:import Import a list of configs
config:list List all configs
config:system:delete Delete a system config value
config:system:get Get a system config value
config:system:set Set a system config value
By default, passwords and other sensitive data are omitted from the report, so the output can be posted publicly (e.g.
as part of a bug report). In order to generate a full backport of all configuration values the --private flag needs to
be set:
The exported content can also be imported again to allow the fast setup of similar instances. The import command
will only add or update values. Values that exist in the current configuration, but not in the one that is being imported
are left untouched:
Note: While it is possible to update/set/delete the versions and installation statuses of apps and Nextcloud itself,
it is not recommended to do this directly. Use the occ app:enable, occ app:disable and occ update
commands instead.
The config:system:set command creates the value, if it does not already exist. To update an existing value, set
--update-only:
Note that in order to write a Boolean, float, or integer value to the configuration file, you need to specify the type on
your command. This applies only to the config:system:set command. The following values are known:
• boolean
• integer
• float
• string (default)
When you want to e.g. disable the maintenance mode run the following command:
Some configurations (e.g. the trusted domain setting) are an array of data. In this case, config:system:get for
this key will return multiple values:
sudo -u www-data php occ config:system:get trusted_domains
localhost
nextcloud.local
sample.tld
To set one of multiple values, you need to specify the array index as the second name in the config:system:set
command, separated by a space. For example, to replace sample.tld with example.com, trusted_domains
=> 2 needs to be set:
sudo -u www-data php occ config:system:set trusted_domains 2
--value=example.com
System config value trusted_domains => 2 set to string example.com
Some configurations use hierarchical data. For example, the settings for the Redis cache would look like this in the
config.php file:
'redis' => array(
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'dbindex' => 0,
'password' => 'secret',
'timeout' => 1.5,
)
Setting such hierarchical values works similarly to setting an array value above. For this Redis example, use the
following commands:
sudo -u www-data php occ config:system:set redis host \
--value=/var/run/redis/redis.sock
sudo -u www-data php occ config:system:set redis port --value=0
sudo -u www-data php occ config:system:set redis dbindex --value=0
sudo -u www-data php occ config:system:set redis password --value=secret
sudo -u www-data php occ config:system:set redis timeout --value=1.5
The delete command will by default not complain if the configuration was not set before. If you want to be notified in
that case, set the --error-if-not-exists flag:
A set of commands to create addressbooks, calendars, and to migrate addressbooks from 8.2 when you upgrade to 9.0:
dav
dav:create-addressbook Create a dav addressbook
dav:create-calendar Create a dav calendar
dav:migrate-addressbooks Migrate addressbooks from the contacts
app to core
dav:migrate-calendars Migrate calendars from the calendar app to
core
dav:sync-birthday-calendar Synchronizes the birthday calendar
dav:sync-system-addressbook Synchronizes users to the system
addressbook
Molly will immediately see these on her Calendar and Contacts pages.
In 9.0, the CalDAV server has been integrated into core. Your existing calendars and contacts should migrate automat-
ically when you upgrade. If something goes wrong you can try a manual migration. First delete any partially-migrated
calendars or addressbooks. Then run this command to migrate user’s contacts:
See ownCloud 9.0 - calendar migration analysis for help with troubleshooting and reporting problems.
dav:sync-birthday-calendar adds all birthdays to your calendar from addressbooks shared with you. This
example syncs to your calendar from user bernie:
The SQLite database is good for testing, and for Nextcloud servers with small single-user workloads that do not use
sync clients, but production servers with multiple users should use MariaDB, MySQL, or PostgreSQL. You can use
occ to convert from SQLite to one of these other databases.
db
db:convert-type Convert the Nextcloud database to the newly
configured one
db:generate-change-script generates the change script from the current
connected db to db_structure.xml
You need:
• Your desired database and its PHP connector installed.
• The login and password of a database admin user.
• The database port number, if it is a non-standard port.
This is example converts SQLite to MySQL/MariaDB:
It might happen that we add from time to time new indices to already existing database tables, for example to improve
performance. In order to check your database for missing indices run following command:
sudo -u www-data php occ db:add-missing-indices
4.2.10 Encryption
encryption
encryption:change-key-storage-root Change key storage root
encryption:decrypt-all Disable server-side encryption and
decrypt all files
encryption:disable Disable encryption
encryption:enable Enable encryption
encryption:enable-master-key Enable the master key. Only available
for fresh installations with no existing
encrypted data! There is also no way to
disable it again.
encryption:encrypt-all Encrypt all files for all users
encryption:list-modules List all available encryption modules
encryption:set-default-module Set the encryption default module
encryption:show-key-storage-root Show current key storage root
encryption:status Lists the current status of encryption
encryption:status shows whether you have active encryption, and your default encryption module. To enable
encryption you must first enable the Encryption app, and then run encryption:enable:
encryption:list-modules displays your available encryption modules. You will see a list of modules only
if you have enabled the Encryption app. Use encryption:set-default-module [module name] to set
your desired module.
encryption:encrypt-all encrypts all data files for all users. You must first put your Nextcloud server into
maintenance mode to prevent any user activity until encryption is completed.
encryption:decrypt-all decrypts all user data files, or optionally a single user:
Users must have enabled recovery keys on their Personal pages. You must first put your Nextcloud server into main-
tenance mode to prevent any user activity until decryption is completed.
Note that if you do not have master key/recovery key enabled, you can ONLY decrypt files per user, one user at a time
and NOT when in maintenance mode. You will need the users’ password to decrypt the files.
Use encryption:disable to disable your encryption module. You must first put your Nextcloud server into
maintenance mode to prevent any user activity.
encryption:enable-master-key creates a new master key, which is used for all user data instead of individual
user keys. This is especially useful to enable single-sign on. Use this only on fresh installations with no existing data,
or on systems where encryption has not already been enabled. It is not possible to disable it.
See Encryption configuration to learn more.
Note: This command is only available when the “Federation” app (federation) is enabled.
In Nextcloud, servers connected with federation shares can share user address books, and auto-complete usernames in
share dialogs. Use this command to synchronize federated servers:
files
files:cleanup cleanup filecache
files:scan rescan filesystem
files:transfer-ownership All files and folders are moved to another
user - shares are moved as well.
Scan
The files:scan command scans for new files and updates the file cache. You may rescan all files, per-user, a
space-delimited list of users, and limit the search path. If not using --quiet, statistics will be shown at the end of
the scan:
Arguments:
user_id will rescan all files of the given user(s)
Options:
--path limit rescan to the user/path given
--all will rescan all files of all known users
--quiet suppress any output
--verbose files and directories being processed are shown
additionally during scanning
--unscanned scan only previously unscanned files
"user_id/files/path"
or
"user_id/files/mount_name"
or
"user_id/files/mount_name/path"
--path="/alice/files/Music"
In the example above, the user_id alice is determined implicitly from the path component given.
The --path, --all and [user_id] parameters and are exclusive - only one must be specified.
Cleanup
files:cleanup tidies up the server’s file cache by deleting all file entries that have no matching entries in the
storage table.
Transfer
You may transfer all files and shares from one user to another. This is useful before removing a user:
It is also possible to transfer only one directory along with it’s contents. This can be useful to restructure your
organization or quotas. The --path argument is given as the path to the directory as seen from the source user:
Note: These commands are only available when the “External storage support” app (files_external) is enabled.
files_external
files_external:applicable Manage applicable users and groups for a mount
files_external:backends Show available authentication and storage backends
files_external:config Manage backend configuration for a mount
files_external:create Create a new mount configuration
files_external:delete Delete an external mount
files_external:export Export mount configurations
files_external:import Import mount configurations
files_external:list List configured mounts
files_external:option Manage mount options for a mount
files_external:verify Verify mount configuration
files_external:notify Listen for active update notifications for a configured
˓→external mount
These commands replicate the functionality in the Nextcloud Web GUI, plus two new features:
files_external:export and files_external:import.
Use files_external:export to export all admin mounts to stdout, and files_external:export
[user_id] to export the mounts of the specified Nextcloud user.
Use files_external:import [filename] to import legacy JSON configurations, and to copy external
mount configurations to another Nextcloud server.
Apps which have an official tag MUST be code signed with Nextcloud. Unsigned official apps won’t be installable
anymore. Code signing is optional for all third-party applications:
integrity
integrity:check-app Check app integrity using a signature.
integrity:check-core Check core integrity using a signature.
integrity:sign-app Signs an app using a private key.
integrity:sign-core Sign core using a private key
After creating your signing key, sign your app like this example:
sudo -u www-data php occ integrity:sign-app --privateKey=/Users/lukasreschke/contacts.
˓→key --certificate=/Users/lukasreschke/CA/contacts.crt --path=/Users/lukasreschke/
˓→Programming/contacts
When it returns nothing, your app is signed correctly. When it returns a message then there is an error. See Code
Signing in the Developer manual for more detailed information. .. TODO ON RELEASE: Update version number
above on release
integrity:sign-core is for Nextcloud core developers only.
See Code signing to learn more.
This command is for app developers to update their translation mechanism from ownCloud 7 to Nextcloud.
Note: These commands are only available when the “LDAP user and group backend” app (user_ldap) is enabled.
These LDAP commands appear only when you have enabled the LDAP app. Then you can run the following LDAP
commands with occ:
ldap
ldap:check-user checks whether a user exists on LDAP.
ldap:create-empty-config creates an empty LDAP configuration
ldap:delete-config deletes an existing LDAP configuration
ldap:search executes a user or group search
ldap:set-config modifies an LDAP configuration
ldap:show-config shows the LDAP configuration
ldap:show-remnants shows which users are not available on
LDAP anymore, but have remnants in
Nextcloud.
ldap:test-config tests an LDAP configuration
Searches will match at the beginning of the attribute value only. This example searches for givenNames that start with
“rob”:
This will find robbie, roberta, and robin. Broaden the search to find, for example, jeroboam with the asterisk
wildcard:
sudo -u www-data php occ ldap:search "*rob"
User search attributes are set with ldap:set-config (below). For example, if your search attributes are
givenName and sn you can find users by first name + last name very quickly. For example, you’ll find Terri
Hanson by searching for te ha. Trailing whitespaces are ignored.
Check if an LDAP user exists. This works only if the Nextcloud server is connected to an LDAP server:
sudo -u www-data php occ ldap:check-user robert
ldap:check-user will not run a check when it finds a disabled LDAP connection. This prevents users that exist
on disabled LDAP connections from being marked as deleted. If you know for certain that the user you are searching
for is not in one of the disabled connections, and exists on an active connection, use the --force option to force it
to check all active LDAP connections:
sudo -u www-data php occ ldap:check-user --force robert
ldap:create-empty-config creates an empty LDAP configuration. The first one you create has no
configID, like this example:
sudo -u www-data php occ ldap:create-empty-config
Created new configuration with configID ''
This is a holdover from the early days, when there was no option to create additional configurations. The second, and
all subsequent, configurations that you create are automatically assigned IDs:
sudo -u www-data php occ ldap:create-empty-config
Created new configuration with configID 's01'
The ldap:set-config command is for manipulating configurations, like this example that sets search attributes:
sudo -u www-data php occ ldap:set-config s01 ldapAttributesForUserSearch
"cn;givenname;sn;displayname;mail"
ldap:test-config tests whether your configuration is correct and can bind to the server:
sudo -u www-data php occ ldap:test-config s01
The configuration is valid and the connection could be established!
ldap:show-remnants is for cleaning up the LDAP mappings table, and is documented in LDAP user cleanup.
log
log:manage manage logging configuration
log:file manipulate Nextcloud logging backend
Use the --enable option to turn on logging. Use --file to set a different log file path. Set your rotation by log
file size in bytes with --rotate-size; 0 disables rotation.
log:manage sets your logging backend, log level, and timezone. The defaults are file, warning, and UTC.
Available options are:
• –backend [file, syslog, errorlog, systemd]
• –level [debug, info, warning, error]
Use these commands when you upgrade Nextcloud, manage encryption, perform backups and other tasks that require
locking users out until you are finished:
maintenance
maintenance:data-fingerprint update the systems data-fingerprint after a
˓→backup is restored
maintenance:mode locks the sessions of all logged-in users, including administrators, and displays a status screen
warning that the server is in maintenance mode. Users who are not already logged in cannot log in until maintenance
mode is turned off. When you take the server out of maintenance mode logged-in users must refresh their Web
browsers to continue working:
After restoring a backup of your data directory or the database, you should always call
maintenance:data-fingerprint once. This changes the ETag for all files in the communication with
sync clients, allowing them to realize a file was modified.
The maintenance:repair command runs automatically during upgrades to clean up the database, so while you
can run it manually there usually isn’t a need to:
maintenance:mimetype:update-db updates the Nextcloud database and file cache with changed mime-
types found in config/mimetypemapping.json. Run this command after modifying config/
mimetypemapping.json. If you change a mimetype, run maintenance:mimetype:update-db
--repair-filecache to apply the change to existing files.
Run the maintenance:theme:update command if the icons of your custom theme are not updated correctly.
This updates the mimetypelist.js and cleares the image cache.
4.2.19 Security
Use these commands to manage server-wide SSL certificates. These are useful when you create federation shares with
other Nextcloud servers that use self-signed certificates:
security
security:certificates list trusted certificates
security:certificates:import import trusted certificate
security:certificates:remove remove trusted certificate
Remove a certificate:
4.2.20 Trashbin
Note: This command is only available when the “Deleted files” app (files_trashbin) is enabled.
The trashbin:cleanup command removes the deleted files of the specified users in a space-delimited list, or all
users if none are specified.
trashbin
trashbin:cleanup Remove deleted files
This example removes the deleted files of users molly and freda:
The user commands create and remove users, reset passwords, display a simple report showing how many users you
have, and when a user was last logged in:
user
user:add adds a user
user:delete deletes the specified user
user:disable disables the specified user
user:enable enables the specified user
user:lastseen shows when the user was logged in last time
user:report shows how many users have access
user:resetpassword Resets the password of the named user
user:setting Read and modify user settings
You can create a new user with their display name, login name, and any group memberships with the user:add
command. The syntax is:
The display-name corresponds to the Full Name on the Users page in your Nextcloud Web UI, and the uid is
their Username, which is their login name. This example adds new user Layla Smith, and adds her to the users and
db-admins groups. Any groups that do not exist are created:
Go to your Users page, and you will see your new user.
password-from-env allows you to set the user’s password from an environment variable. This prevents the
password from being exposed to all users via the process list, and will only be visible in the history of the user (root)
running the command. This also permits creating scripts for adding multiple new users.
To use password-from-env you must run as “real” root, rather than sudo, because sudo strips environment
variables. This example adds new user Fred Jones:
export OC_PASS=newpassword
su -s /bin/sh www-data -c 'php occ user:add --password-from-env
--display-name="Fred Jones" --group="users" fred'
The user "fred" was created successfully
Display name set to "Fred Jones"
User "fred" added to group "users"
You can reset any user’s password, including administrators (see Resetting a lost admin password):
Filter by app:
sudo -u www-data php occ user:setting layla core
- core:
- lang: en
Set a setting:
sudo -u www-data php occ user:setting layla settings email "[email protected]"
Delete a setting:
sudo -u www-data php occ user:setting layla settings email --delete
Generate a simple report that counts all users, including users on external user authentication servers such as LDAP:
sudo -u www-data php occ user:report
+------------------+----+
| User Report | |
+------------------+----+
| Database | 12 |
| LDAP | 86 |
| | |
| total users | 98 |
| | |
| user directories | 2 |
+------------------+----+
The group commands create and remove groups, add and remove users in groups, display a list of all users in a
group:
group
group:add add a group
group:delete remove a group
group:adduser add a user to a group
group:removeuser remove a user from a group
group:list list configured groups
You can create a new group with the group:add command. The syntax is:
group:add [gid]
The gid corresponds to the group name you entering after clicking “Add group” on the Users page in your Nextcloud
Web UI. This example adds new group “beer”:
Add an existing user to the specified group with the group:adduser command. The syntax is:
This example adds the user “denis” to the existing group “beer”:
You can remove user from the group with the group:removeuser command. This example removes the existing
user “denis” from the existing group “beer”:
Remove a group with the group:delete command. Removing a group doesn’t remove users in a group. You
cannot remove the “admin” group. This example removes the existing group “beer”:
List configured groups via the group:list command. The syntax is:
4.2.23 Versions
Note: This command is only available when the “Versions” app (files_versions) is enabled.
Use this command to delete file versions for specific users, or for all users when none are specified:
versions
versions:cleanup Delete versions
These commands are available only after you have downloaded and unpacked the Nextcloud archive, and taken no
further installation steps.
You can install Nextcloud entirely from the command line. After downloading the tarball and copying Nextcloud into
the appropriate directories you can use occ commands in place of running the graphical Installation Wizard.
Then choose your occ options. This lists your available options:
Usage:
[options] command [arguments]
Options:
--help (-h) Display this help message
--quiet (-q) Do not output any message
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal
output, 2 for more verbose output and 3 for debug
--version (-V) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--no-interaction (-n) Do not ask any interactive question
Available commands:
check check dependencies of the server environment
Options:
--database Supported database type (default: "sqlite")
--database-name Name of the database
--database-host Hostname of the database (default: "localhost")
--database-user User name to connect to the database
--database-pass Password of the database user
--database-table-prefix Prefix for all tables (default: oc_)
--admin-user User name of the admin account (default: "admin")
--admin-pass Password of the admin account
--data-dir Path to data directory (default:
"/var/www/nextcloud/data")
--help (-h) Display this help message
--quiet (-q) Do not output any message
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal
output, 2 for more verbose output and 3 for debug
--version (-V) Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
--no-interaction (-n) Do not ask any interactive question
cd /var/www/nextcloud/
sudo -u www-data php occ maintenance:install --database
"mysql" --database-name "nextcloud" --database-user "root" --database-pass
"password" --admin-user "admin" --admin-pass "password"
Nextcloud is not installed - only a limited number of commands are available
Nextcloud was successfully installed
These commands are available only after you have downloaded upgraded packages or tar archives, and before you
complete the upgrade.
List all options, like this example on CentOS Linux:
Options:
--help (-h) Display this help message.
--quiet (-q) Do not output any message.
--verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output,
2 for more verbose output and 3 for debug.
--version (-V) Display this application version.
--ansi Force ANSI output.
--no-ansi Disable ANSI output.
--no-interaction (-n) Do not ask any interactive question
When you are performing an update or upgrade on your Nextcloud server (see the Maintenance section of this manual),
it is better to use occ to perform the database upgrade step, rather than the Web GUI, in order to avoid timeouts. PHP
scripts invoked from the Web interface are limited to 3600 seconds. In larger environments this may not be enough,
leaving the system in an inconsistent state. After performing all the preliminary steps (see How to upgrade) use this
command to upgrade your databases, like this example on CentOS Linux. Note how it details the steps:
If there is an error it throws an exception, and the error is detailed in your Nextcloud logfile, so you can use the log
output to figure out what went wrong, or to use in a bug report:
If a two-factor provider app is enabled, it is enabled for all users by default (though the provider can decide whether
or not the user has to pass the challenge). In the case of an user losing access to the second factor (e.g. lost phone
with two-factor SMS verification), the admin can temporarily disable the two-factor check for that user via the occ
command:
Note that once users are disabled, their connected browsers will be disconnected.
You can configure your Nextcloud server to automatically send out e-mail notifications to your users for various events
like:
• A file or folder has been shared
• A new file or folder has been created
• A file or folder has been changed
• A file or folder has been deleted
Users can see actions (delete, add, modify) that happen to files they have access to. Sharing actions are only visible to
the sharer and sharee.
The Activity App is shipped and enabled by default. If it is not enabled simply go to your Nextcloud Apps page to
enable it.
To configure your Nextcloud to send out e-mail notifications a working Email configuration is mandatory.
Furthermore it is recommended to configure the background job Webcron or Cron as described in Defining back-
ground jobs.
There is also a configuration option activity_expire_days available in your config.php (See Configuration
Parameters) which allows you to clean-up older activities from the database.
In certain scenarios it makes sense to send the activity emails out more regularly, e.g. you want to send the hourly
emails always at the full hour, daily emails before people start to work in the morning and weekly mails shall be send
on monday morning, so people can read up when starting into the week.
Therefore in Nextcloud 12 a console command was added to allow sending those emails intentionally. This allows to
set up special cron jobs on your server with the known granularity, instead of relying on the Nextcloud cron feature
which is not very flexible on scheduling.
To implement the samples mentioned above, the following three entries are necessary:
# crontab -u www-data -e
0 * * * * php -f /var/www/nextcloud/occ activity:send-mails hourly
30 7 * * * php -f /var/www/nextcloud/occ activity:send-mails daily
30 7 * * MON php -f /var/www/nextcloud/occ activity:send-mails weekly
If you want to manually send out all activity emails which are queued, you can run occ activity:send-mails
without any argument.
You can significantly improve your Nextcloud server performance with memory caching, where frequently-requested
objects are stored in memory for faster retrieval. There are two types of caches to use: a PHP opcode cache, which is
commonly called opcache, and data caching for your Web server. If you do not install and enable a local memcache
you will see a warning on your Nextcloud admin page. A memcache is not required and you may safely ignore the
warning if you prefer.
Note: If you enable only a distributed cache in your config.php (memcache.distributed) and not a local
cache (memcache.local) you will still see the cache warning.
A PHP opcache stores compiled PHP scripts so they don’t need to be re-compiled every time they are called. PHP
bundles the Zend OPcache in core since version 5.5, so you don’t need to install an opcache manually.
Data caching is supplied by the user (APCu), Memcached or Redis.
Nextcloud supports multiple memory caching backends, so you can choose the type of memcache that best fits your
needs. The supported caching backends are:
4.4.1 APCu
PHP 5.5 and up include the Zend OPcache in core, and on most Linux distributions it is enabled by default. However,
it does not bundle a data cache. APCu is a data cache, and it is available in most Linux distributions. On Red
Hat/CentOS/Fedora systems install php-pecl-apcu. On Debian/Ubuntu/Mint systems install php-apcu. On
Ubuntu 14.04 LTS, the APCu version (4.0.2) is too old to use with Nextcloud (requires 4.0.6+). You may install 4.0.7
from Ubuntu backports with this command:
Refresh your Nextcloud admin page, and the cache warning should disappear.
4.4.2 Memcached
Memcached is a reliable oldtimer for shared caching on distributed servers, and performs well with Nextcloud with
one exception: it is not suitable to use with Transactional File Locking because it does not store locks, and data can
disappear from the cache at any time (Redis is the best memcache for this).
Note: Be sure to install the memcached PHP module, and not memcache, as in the following examples. Nextcloud
supports only the memcached PHP module.
Setting up Memcached is easy. On Debian/Ubuntu/Mint install memcached and php5-memcached. The installer
will automatically start memcached and configure it to launch at startup.
On Red Hat/CentOS/Fedora install memcached and php-pecl-memcached. It will not start automatically, so
you must use your service manager to start memcached, and to launch it at boot as a daemon.
You can verify that the Memcached daemon is running with ps ax:
ps ax | grep memcached
19563 ? Sl 0:02 /usr/bin/memcached -m 64 -p 11211 -u memcache -l
127.0.0.1
Restart your Web server, add the appropriate entries to your config.php, and refresh your Nextcloud admin page.
This example uses APCu for the local cache, Memcached as the distributed memcache, and lists all the servers in the
shared cache pool with their port numbers:
4.4.3 Redis
Redis is an excellent modern memcache to use for both distributed caching, and as a local cache for Transactional File
Locking because it guarantees that cached objects are available for as long as they are needed.
The Redis PHP module must be version 2.2.6+. If you are running a Linux distribution that does not package the
supported versions of this module, or does not package Redis at all, see Additional Redis installation help.
On Debian/Ubuntu/Mint install redis-server and php-redis. The installer will automatically launch
redis-server and configure it to launch at startup.
On CentOS and Fedora install redis and php-pecl-redis. It will not start automatically, so you must use your
service manager to start redis, and to launch it at boot as a daemon.
You can verify that the Redis daemon is running with ps ax:
ps ax | grep redis
22203 ? Ssl 0:00 /usr/bin/redis-server 127.0.0.1:6379
Restart your Web server, add the appropriate entries to your config.php, and refresh your Nextcloud admin page.
This example config.php configuration uses Redis for the local server cache:
For best performance, use Redis for file locking by adding this:
If you want to connect to Redis configured to listen on an Unix socket (which is recommended if Redis is running on
the same system as Nextcloud) use this example config.php configuration:
Only “host” and “port” variables are required, the other ones are optional.
Redis is very configurable; consult the Redis documentation to learn more.
The cache directory defaults to data/$user/cache where $user is the current user. You may use the
'cache_path' directive in config.php (See Configuration Parameters) to select a different location.
APCu is faster at local caching than Redis. If you have enough memory, use APCu for Memory Caching and Redis
for File Locking. If you are low on memory, use Redis for both.
If your version of Mint or Ubuntu does not package the required version of php5-redis, then try this Redis guide
on Tech and Me for a complete Redis installation on Ubuntu 14.04 using PECL. These instructions are adaptable for
any distro that does not package the supported version, or that does not package Redis at all, such as SUSE Linux
Enterprise Server and Red Hat Enterprise Linux.
The Redis PHP module must be at least version 2.2.6.
For PHP 7.0 and PHP 7.1 use Redis PHP module 3.1.x or later.
See https://pecl.php.net/package/redis
On Debian/Mint/Ubuntu, use apt-cache to see the available php5-redis version, or the version of your installed
package:
On CentOS and Fedora, the yum command shows available and installed version information:
A system like Nextcloud sometimes requires tasks to be done on a regular basis without the need for user interaction
or hindering Nextcloud performance. For that purpose, as a system administrator, you can define background jobs (for
example, database clean-ups) which are executed without any need for user interaction.
These jobs are typically referred to as cron jobs. Cron jobs are commands or shell-based scripts that are scheduled
to run periodically at fixed times, dates, or intervals. cron.php is an Nextcloud internal process that runs such
background jobs on demand.
Nextcloud plug-in applications register actions with cron.php automatically to take care of typical housekeeping
operations, such as garbage collecting of temporary files or checking for newly updated files using filescan() for
externally mounted file systems.
4.5.1 Parameters
In the admin settings menu you can configure how cron-jobs should be executed. You can choose between the follow-
ing options:
• AJAX
• Webcron
• Cron
You can schedule cron jobs in three ways – using AJAX, Webcron, or cron. The default method is to use AJAX.
However, the recommended method is to use cron. The following sections describe the differences between each
method.
AJAX
The AJAX scheduling method is the default option. Unfortunately, however, it is also the least reliable. Each time a
user visits the Nextcloud page, a single background job is executed. The advantage of this mechanism is that it does
not require access to the system nor registration with a third party service. The disadvantage of this mechanism, when
compared to the Webcron service, is that it requires regular visits to the page for it to be triggered.
Note: Especially when using the Activity App or external storages, where new files are added, updated or deleted one
of the two methods below should be preferred.
Webcron
By registering your Nextcloud cron.php script address at an external webcron service (for example, easyCron), you
ensure that background jobs are executed regularly. To use this type of service with your server, you must be able to
access your server using the Internet. For example:
Cron
Using the operating system cron feature is the preferred method for executing regular tasks. This method enables the
execution of scheduled jobs without the inherent limitations the Web server might have.
To run a cron job on a *nix system, every 15 minutes, under the default Web server user (often, www-data or
wwwrun), you must set up the following cron job to call the cron.php script:
# crontab -u www-data -e
*/15 * * * * php -f /var/www/nextcloud/cron.php
You can verify if the cron job has been added and scheduled by executing:
# crontab -u www-data -l
*/15 * * * * php -f /var/www/nextcloud/cron.php
Note: You have to replace the path /var/www/nextcloud/cron.php with the path to your current Nextcloud
installation.
Note: Please refer to the crontab man page for the exact command syntax.
systemd
[Unit]
Description=Nextcloud cron.php job
[Service]
User=www-data
ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php
[Install]
WantedBy=basic.target
Replace the user www-data with the user of your http server and /var/www/nextcloud/cron.php with the
location of cron.php in your nextcloud directory.
nextcloudcron.timer should look like this:
[Unit]
Description=Run Nextcloud cron.php every 15 minutes
[Timer]
OnBootSec=5min
OnUnitActiveSec=15min
Unit=nextcloudcron.service
[Install]
WantedBy=timers.target
The important parts in the timer-unit are OnBootSec and OnUnitActiveSec.‘‘OnBootSec‘‘ will start the timer
5 minutes after boot, otherwise you would have to start it manually after every boot. OnUnitActiveSec will set a
15 minute timer after the service-unit was last activated.
Now all that is left is to start and enable the timer by running these commands:
Note: Select the option Cron in the admin menu for background jobs. if left on AJAX it would execute the AJAX
job on every page load.
Note: The installer creates a configuration containing the essential parameters. Only manually add configuration
parameters to config/config.php if you need to use a special value for a parameter. Do not copy everything
from config/config.sample.php . Only enter the parameters you wish to modify!
Nextcloud supports loading configuration parameters from multiple files. You can add arbitrary files ending with
.config.php in the config/ directory, for example you could place your email server configuration in email.
config.php. This allows you to easily create and manage custom configurations, or to divide a large complex
configuration file into a set of smaller files. These custom files are not overwritten by Nextcloud, and the values in
these files take precedence over config.php.
These parameters are configured by the Nextcloud installer, and are required for your Nextcloud server to operate.
This is a unique identifier for your Nextcloud installation, created automatically by the installer. This example is for
documentation only, and you should never use it because it will not work. A valid instanceid is created when you
install Nextcloud.
‘instanceid’ => ‘d3c944a9a’,
The salt used to hash all passwords, auto-generated by the Nextcloud installer. (There are also per-user salts.) If you
lose this salt you lose all your passwords. This example is for documentation only, and you should never use it.
'trusted_domains' =>
array (
'demo.example.org',
'otherdomain.example.org',
),
Your list of trusted domains that users can log into. Specifying trusted domains prevents host header poisoning. Do
not remove this, as it performs necessary security checks.
You can specify:
• the exact hostname of your host or virtual host, e.g. demo.example.org.
• the exact hostname with permitted port, e.g. demo.example.org:443. This disallows all other ports on this host
• use * as a wildcard, e.g. ubos-raspberry-pi*.local will allow ubos-raspberry-pi.local and ubos-raspberry-pi-
2.local
Where user files are stored. The SQLite database is also stored here, when you use SQLite.
Default to data/ in the Nextcloud directory.
The current version number of your Nextcloud installation. This is set up during installation and update, so you
shouldn’t need to change it.
Identifies the database used with this installation. See also config option supportedDatabases
Available:
• sqlite3 (SQLite3)
• mysql (MySQL/MariaDB)
• pgsql (PostgreSQL)
Defaults to sqlite3
Your host server name, for example localhost, hostname, hostname.example.com, or the IP address. To
specify a port use hostname:####; to specify a Unix socket use localhost:/path/to/socket.
The name of the Nextcloud database, which is set during installation. You should not need to change this.
The user that Nextcloud uses to write to the database. This must be unique across Nextcloud instances using the same
SQL database. This is set up during installation, so you shouldn’t need to change it.
The password for the database user. This is set up during installation, so you shouldn’t need to change it.
Indicates whether the Nextcloud instance was installed successfully; true indicates a successful installation, and
false indicates an unsuccessful installation.
Defaults to false
When you use SQLite as your Nextcloud database, your config.php looks like this after installation. The SQLite
database is stored in your Nextcloud data/ directory. SQLite is a simple, lightweight embedded database that is
good for testing and for simple installations, but for production Nextcloud systems you should use MySQL, MariaDB,
or PosgreSQL.
<?php
$CONFIG = array (
'instanceid' => 'occ6f7365735',
'passwordsalt' => '2c5778476346786306303',
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'studio',
),
'datadirectory' => '/var/www/nextcloud/data',
'dbtype' => 'sqlite3',
'version' => '7.0.2.1',
'installed' => true,
);
<?php
$CONFIG = array (
'instanceid' => 'oc8c0fd71e03',
'passwordsalt' => '515a13302a6b3950a9d0fdb970191a',
'trusted_domains' =>
array (
0 => 'localhost',
1 => 'studio',
2 => '192.168.10.155'
),
'datadirectory' => '/var/www/nextcloud/data',
'dbtype' => 'mysql',
'version' => '7.0.2.1',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'oc_carla',
'dbpassword' => '67336bcdf7630dd80b2b81a413d07',
'installed' => true,
);
These optional parameters control some aspects of the user interface. Default values, where present, are shown.
This sets the default language on your Nextcloud server, using ISO_639-1 language codes such as en for English, de
for German, and fr for French. It overrides automatic language detection on public pages like login or shared items.
User’s language preferences configured under “personal -> language” override this setting after they have logged in.
Nextcloud has two distinguished language codes for German, ‘de’ and ‘de_DE’. ‘de’ is used for informal German and
‘de_DE’ for formal German. By setting this value to ‘de_DE’ you can enforce the formal version of German unless
the user has chosen something different explicitly.
Defaults to en
With this setting a language can be forced for all users. If a language is forced, the users are also unable to change their
language in the personal settings. If users shall be unable to change their language, but users have different languages,
this value can be set to true instead of a language code.
Defaults to false
This sets the default locale on your Nextcloud server, using ISO_639 language codes such as en for English, de for
German, and fr for French, and ISO-3166 country codes such as GB, US, CA, as defined in RFC 5646. It overrides
automatic locale detection on public pages like login or shared items. User’s locale preferences configured under
“personal -> locale” override this setting after they have logged in.
Defaults to en
With this setting a locale can be forced for all users. If a locale is forced, the users are also unable to change their
locale in the personal settings. If users shall be unable to change their locale, but users have different languages, this
value can be set to true instead of a locale code.
Defaults to false
Set the default app to open on login. Use the app names as they appear in the URL after clicking them in the Apps
menu, such as documents, calendar, and gallery. You can use a comma-separated list of app names, so if the first app
is not enabled for a user then Nextcloud will try the second one, and so on. If no enabled apps are found it defaults to
the Files app.
Defaults to files
true enables the Help menu item in the user menu (top right of the Nextcloud Web interface). false removes the
Help item.
true allows users to change their display names (on their Personal pages), and false prevents them from changing
their display names.
Lifetime of the remember login cookie, which is set when the user clicks the remember checkbox on the login screen.
Defaults to 60*60*24*15 seconds (15 days)
Enable or disable session keep-alive when a user is logged in to the Web UI.
Enabling this sends a “heartbeat” to the server to keep it from timing out.
Defaults to true
Enforce token authentication for clients, which blocks requests using the user password for enhanced security. Users
need to generate tokens in personal settings which can be used as passwords on their clients.
Defaults to false
Whether the bruteforce protection shipped with Nextcloud should be enabled or not.
Disabling this is discouraged for security reasons.
Defaults to true
The directory where the skeleton files are located. These files will be copied to the data directory of new users. Leave
empty to not copy any skeleton files.
{lang} can be used as a placeholder for the language of the user. If the directory does not exist, it falls back to non
dialect (from de_DE to de). If that does not exist either, it falls back to default
Defaults to core/skeleton in the Nextcloud directory.
The user_backends app (which needs to be enabled first) allows you to configure alternate authentication back-
ends. Supported backends are: IMAP (OC_User_IMAP), SMB (OC_User_SMB), and FTP (OC_User_FTP).
'lost_password_link' => 'https://example.org/link/to/password/reset',
If your user backend does not allow password resets (e.g. when it’s a read-only user backend like LDAP), you can
specify a custom link, where the user is redirected to, when clicking the “reset password” link after a failed login-
attempt.
In case you do not want to provide any link, replace the url with ‘disabled’
These configure the email settings for Nextcloud notifications and password resets.
'mail_domain' => 'example.com',
The return address that you want to appear on emails sent by the Nextcloud server, for example
[email protected], substituting your own domain, of course.
'mail_from_address' => 'nextcloud',
FROM address that overrides the built-in sharing-noreply and lostpassword-noreply FROM addresses.
Defaults to different from addresses depending on the feature.
'mail_smtpdebug' => false,
This depends on mail_smtpmode. Specify the IP address of your mail server host. This may contain multiple hosts
separated by a semi-colon. If you need to specify the port number append it to the IP address separated by a colon,
like this: 127.0.0.1:24.
Defaults to 127.0.0.1
This depends on mail_smtpmode. This sets the SMTP server timeout, in seconds. You may need to increase this if
you are running an anti-malware or spam scanner.
Defaults to 10 seconds
This depends on mail_smtpmode. Specify when you are using ssl or tls, or leave empty for no encryption.
Defaults to '' (empty string)
This depends on mail_smtpmode. Change this to true if your mail server requires authentication.
Defaults to false
This depends on mail_smtpmode. If SMTP authentication is required, choose the authentication type as LOGIN or
PLAIN.
Defaults to LOGIN
This depends on mail_smtpauth. Specify the username for authenticating to the SMTP server.
Defaults to '' (empty string)
This depends on mail_smtpauth. Specify the password for authenticating to the SMTP server.
Default to '' (empty string)
Replaces the default mail template layout. This can be utilized if the options to modify the mail texts with the theming
app is not enough.
The class must extend \OC\Mail\EMailTemplate
Email will be send by default with an HTML and a plain text body. This option allows to only send plain text emails.
The automatic hostname detection of Nextcloud can fail in certain reverse proxy and CLI/cron situations. This option
allows you to manually override the automatic detection; for example www.example.com, or specify the port www.
example.com:8080.
When generating URLs, Nextcloud attempts to detect whether the server is accessed via https or http. However,
if Nextcloud is behind a proxy and the proxy handles the https calls, Nextcloud would not know that ssl is in use,
which would result in incorrect URLs being generated.
Valid values are http and https.
This option allows you to define a manual override condition as a regular expression for the remote IP address. For
example, defining a range of IP addresses starting with 10.0.0. and ending with 1 to 3: ^10\.0\.0\.[1-3]$
Defaults to '' (empty string)
Use this configuration parameter to specify the base URL for any URLs which are generated within Nextcloud us-
ing any kind of command line tools (cron or occ). The value should contain the full base URL: https://www.
example.com/nextcloud
Defaults to '' (empty string)
For server setups, that don’t have mod_env enabled or restricted (e.g. suEXEC) this parameter has to be set to true and
will assume mod_rewrite.
Please check, if mod_rewrite is active and functional before setting this parameter and you updated your .htaccess
with occ maintenance:update:htaccess. Otherwise your nextcloud installation might not be reachable anymore. For
example, try accessing resources by leaving out index.php in the URL.
The optional authentication for the proxy to use to connect to the internet.
The format is: username:password.
Defaults to '' (empty string)
If the trash bin app is enabled (default), this setting defines the policy for when files and folders in the trash bin will
be permanently deleted.
The app allows for two settings, a minimum time for trash bin retention, and a maximum time for trash bin retention.
Minimum time is the number of days a file will be kept, after which it may be deleted. Maximum time is the number of
days at which it is guaranteed to be deleted. Both minimum and maximum times can be set together to explicitly define
file and folder deletion. For migration purposes, this setting is installed initially set to “auto”, which is equivalent to
the default setting in Nextcloud.
Available values:
• auto default setting. keeps files and folders in the trash bin for 30 days and automatically deletes anytime after
that if space is needed (note: files may not be deleted if space is not needed).
• D, auto keeps files and folders in the trash bin for D+ days, delete anytime if space needed (note: files may
not be deleted if space is not needed)
• auto, D delete all files in the trash bin that are older than D days automatically, delete other files anytime if
space needed
• D1, D2 keep files and folders in the trash bin for at least D1 days and delete when exceeds D2 days
• disabled trash bin auto clean disabled, files and folders will be kept forever
Defaults to auto
If the versions app is enabled (default), this setting defines the policy for when versions will be permanently deleted.
The app allows for two settings, a minimum time for version retention, and a maximum time for version retention.
Minimum time is the number of days a version will be kept, after which it may be deleted. Maximum time is the
number of days at which it is guaranteed to be deleted. Both minimum and maximum times can be set together to
explicitly define version deletion. For migration purposes, this setting is installed initially set to “auto”, which is
equivalent to the default setting in Nextcloud.
Available values:
• auto default setting. Automatically expire versions according to expire rules. Please refer to Controlling file
versions and aging for more information.
• D, auto keep versions at least for D days, apply expire rules to all versions that are older than D days
• auto, D delete all versions that are older than D days automatically, delete other versions according to expire
rules
• D1, D2 keep versions for at least D1 days and delete when exceeds D2 days
• disabled versions auto clean disabled, versions will be kept forever
Defaults to auto
Nextcloud performs several verification checks. There are two options, true and false.
'appcodechecker' => true,
Checks an app before install whether it uses private APIs instead of the proper public APIs. If this is set to true it will
only allow to install or enable apps that pass this check.
Defaults to false
'updatechecker' => true,
Allows Nextcloud to verify a working .well-known URL redirects. This is done by attempting to make a request from
JS to https://your-domain.com/.well-known/caldav/
Defaults to true
This is a crucial security check on Apache servers that should always be set to true. This verifies that the .
htaccess file is writable and works.
If it is not, then any options controlled by .htaccess, such as large file uploads, will not work. It also runs checks
on the data/ directory, which verifies that it can’t be accessed directly through the Web server.
Defaults to true
In rare setups (e.g. on Openshift or docker on windows) the permissions check might block the installation while the
underlying system offers no means to “correct” the permissions. In this case, set the value to false.
In regular cases, if issues with permissions are encountered they should be adjusted accordingly. Changing the flag is
discouraged.
Defaults to true
4.6.9 Logging
Name of the file to which the Nextcloud logs are written if parameter log_type is set to file.
Defaults to [datadirectory]/nextcloud.log
'loglevel' => 2,
Loglevel to start logging at. Valid values are: 0 = Debug, 1 = Info, 2 = Warning, 3 = Error, and 4 = Fatal. The default
value is Warning.
Defaults to 2
If you maintain different instances and aggregate the logs, you may want to distinguish between them. syslog_tag
can be set per instance with a unique id. Only available if log_type is set to syslog or systemd.
The default value is Nextcloud.
'log.condition' => [
'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9',
'users' => ['sample-user'],
'apps' => ['files'],
],
Log condition for log level increase based on conditions. Once one of these conditions is met, the required log level is
set to debug. This allows to debug specific requests, users or apps
Supported conditions:
• shared_secret: if a request parameter with the name log_secret is set to this value the condition
is met
• users: if the current request is done by one of the specified users, this condition is met
• apps: if the log message is invoked by one of the specified apps, this condition is met
Defaults to an empty array.
The timezone for logfiles. You may change this; see http://php.net/manual/en/timezones.php
Defaults to UTC
Append all database queries and parameters to the log file. Use this only for debugging, as your logfile will become
huge.
Enables log rotation and limits the total size of logfiles. The default is 0, or no rotation. Specify a size in bytes, for
example 104857600 (100 megabytes = 100 * 1024 * 1024 bytes). A new logfile is created with a new name when the
old logfile reaches your limit. If a rotated log file is already present, it will be overwritten.
Defaults to 100 MB
'customclient_desktop' =>
'https://nextcloud.com/install/#install-clients',
'customclient_android' =>
'https://play.google.com/store/apps/details?id=com.nextcloud.client',
'customclient_ios' =>
'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8',
'customclient_ios_appid' =>
'1125420102',
This section is for configuring the download links for Nextcloud clients, as seen in the first-run wizard and on Personal
pages.
Defaults to:
• Desktop client: https://nextcloud.com/install/#install-clients
• Android client: https://play.google.com/store/apps/details?id=com.
nextcloud.client
• iOS client: https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8
• iOS client app id: 1125420102
4.6.11 Apps
Options for the Apps folder, Apps store, and App code checker.
When enabled, admins may install apps from the Nextcloud app store.
Defaults to true
Use the apps_paths parameter to set the location of the Apps directory, which should be scanned for available apps,
and where user-specific apps should be installed from the Apps store. The path defines the absolute file system path
to the app folder. The key url defines the HTTP Web path to that folder, starting from the Nextcloud webroot. The
key writable indicates if a Web server can write files to that folder.
Checks an app before install whether it uses private APIs instead of the proper public APIs. If this is set to true it will
only allow to install or enable apps that pass this check.
Defaults to false
4.6.12 Previews
Nextcloud supports previews of image files, the covers of MP3 files, and text files. These options control enabling and
disabling previews, and thumbnail size.
'enable_previews' => true,
The maximum width, in pixels, of a preview. A value of null means there is no limit.
Defaults to 4096
'preview_max_y' => 4096,
The maximum height, in pixels, of a preview. A value of null means there is no limit.
Defaults to 4096
'preview_max_filesize_image' => 50,
max file size for generating image previews with imagegd (default behavior) If the image is bigger, it’ll try other
preview generators, but will most likely show the default mimetype icon. Set to -1 for no limit.
Defaults to 50 megabytes
'preview_libreoffice_path' => '/usr/bin/libreoffice',
4.6.13 LDAP
defines the interval in minutes for the background job that checks user existence and marks them as ready to be cleaned
up. The number is always minutes. Setting it to 0 disables the feature.
See command line (occ) methods ldap:show-remnants and user:delete
Defaults to 51 minutes
Sort groups in the user settings by name instead of the user count
By enabling this the user count beside the group name is disabled as well.
4.6.14 Comments
Replaces the default Comments Manager Factory. This can be utilized if an own or 3rdParty CommentsManager
should be used that – for instance – uses the filesystem instead of the database to keep the comments.
Defaults to \OC\Comments\ManagerFactory
Replaces the default System Tags Manager Factory. This can be utilized if an own or 3rdParty SystemTagsManager
should be used that – for instance – uses the filesystem instead of the database to keep the tags.
Defaults to \OC\SystemTag\ManagerFactory
4.6.15 Maintenance
These options are for halting user activity when you are performing server maintenance.
4.6.16 SSL
'redis' => [
'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock'
'port' => 6379,
'timeout' => 0.0,
'password' => '', // Optional, if not defined no password will be used.
'dbindex' => 0, // Optional, if undefined SELECT will not run and will use
˓→Redis Server's default DB Index.
],
Connection details for redis to use for memory caching in a single server configuration.
For enhanced security it is recommended to configure Redis to require a password. See http://redis.io/topics/security
for more information.
'redis.cluster' => [
'seeds' => [ // provide some/all of the cluster servers to bootstrap
˓→discovery, port required
'localhost:7000',
'localhost:7001'
],
'timeout' => 0.0,
'read_timeout' => 0.0,
'failover_mode' => \RedisCluster::FAILOVER_ERROR
],
Server details for one or more memcached servers to use for memory caching.
// Enable compression
\Memcached::OPT_COMPRESSION => true,
Location of the cache folder, defaults to data/$user/cache where $user is the current user. When specified, the
format will change to $cache_path/$user where $cache_path is the configured cache directory and $user
is the user.
TTL of chunks located in the cache folder before they’re removed by garbage collection (in seconds). Increase this
value if users have issues uploading very large files via the Nextcloud Client as upload isn’t completed within one day.
Defaults to 60*60*24 (1 day)
'objectstore' => [
'class' => 'OC\\Files\\ObjectStore\\Swift',
'arguments' => [
// trystack will use your facebook id as the user name
'username' => 'facebook100000123456789',
// in the trystack dashboard go to user -> settings -> API Password to
// generate a password
'password' => 'Secr3tPaSSWoRdt7',
// must already exist in the objectstore, name can be different
'container' => 'nextcloud',
// prefix to prepend to the fileid, default is 'oid:urn:'
'objectPrefix' => 'oid:urn:',
// create the container if it does not exist. default is false
'autocreate' => true,
// required, dev-/trystack defaults to 'RegionOne'
'region' => 'RegionOne',
// The Identity / Keystone endpoint
'url' => 'http://8.21.28.222:5000/v2.0',
// required on dev-/trystack
'tenantName' => 'facebook100000123456789',
// dev-/trystack uses swift by default, the lib defaults to
˓→'cloudFiles'
// if omitted
'serviceName' => 'swift',
// The Interface / url Type, optional
'urlType' => 'internal'
],
],
This example shows how to configure Nextcloud to store all files in a swift object storage.
It is important to note that Nextcloud in object store mode will expect exclusive access to the object store container
because it only stores the binary data for each file. The metadata is currently kept in the local database for performance
reasons.
WARNING: The current implementation is incompatible with any app that uses direct file IO and circumvents our
virtual filesystem. That includes Encryption and Gallery. Gallery will store thumbnails directly in the filesystem and
encryption will cause severe overhead because key files need to be fetched in addition to any requested file.
One way to test is applying for a trystack account at http://trystack.org/
'objectstore' => [
'class' => 'OC\\Files\\ObjectStore\\Swift',
'arguments' => [
'autocreate' => true,
'user' => [
'name' => 'swift',
To use swift V3
4.6.19 Sharing
Replaces the default Share Provider Factory. This can be utilized if own or 3rdParty Share Providers are used that –
for instance – use the filesystem instead of the database to keep the share information.
Defaults to \OC\Share20\ProviderFactory
'sharing.maxAutocompleteResults' => 0,
Define max number of results returned by the user search for auto-completion Default is unlimited (value set to 0).
'sharing.minSearchStringLength' => 0,
Define the minimum length of the search string before we start auto-completion Default is no limit (value set to 0)
Additional driver options for the database connection, eg. to enable SSL encryption in MySQL or specify a custom
wait timeout on a cheap hoster.
sqlite3 journal mode can be specified using this configuration parameter - can be ‘WAL’ or ‘DELETE’ see for more
details https://www.sqlite.org/wal.html
During setup, if requirements are met (see below), this setting is set to true and MySQL can handle 4 byte characters
instead of 3 byte characters.
If you want to convert an existing 3-byte setup into a 4-byte setup please set the parameters in MySQL as mentioned
below and run the migration command: ./occ db:convert-mysql-charset The config setting will be set automatically
after a successful run.
Consult the documentation for more details.
MySQL requires a special setup for longer indexes (> 767 bytes) which are needed:
[mysqld] innodb_large_prefix=ON innodb_file_format=Barracuda innodb_file_per_table=ON
Tables will be created with
• character set: utf8mb4
• collation: utf8mb4_bin
• row_format: compressed
See: https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html https://dev.mysql.com/
doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_large_prefix https://mariadb.com/kb/en/
mariadb/xtradbinnodb-server-system-variables/#innodb_large_prefix http://www.tocker.ca/2013/10/31/
benchmarking-innodb-page-compression-performance.html http://mechanics.flite.com/blog/2014/07/29/
using-innodb-large-prefix-to-avoid-error-1071/
Override where Nextcloud stores temporary files. Useful in situations where the system temporary directory is on a
limited space ramdisk or is otherwise restricted, or if external storages which do not support streaming are in use.
The Web server user must have write access to this directory.
The hashing cost used by hashes generated by Nextcloud Using a higher value requires more time and CPU power to
calculate the hashes
Blacklist a specific file or files and disallow the upload of files with this name. .htaccess is blocked by default.
WARNING: USE THIS ONLY IF YOU KNOW WHAT YOU ARE DOING.
Defaults to array('.htaccess')
Define a default folder for shared files and folders other than root.
Defaults to /
If you are applying a theme to Nextcloud, enter the name of the theme here.
The default location for themes is nextcloud/themes/.
Defaults to the theming app which is shipped since Nextcloud 9
The default cipher for encrypting files. Currently AES-128-CFB and AES-256-CFB are supported.
The minimum Nextcloud desktop client version that will be allowed to sync with this server instance. All connections
made from earlier clients will be denied by the server. Defaults to the minimum officially supported Nextcloud desktop
clientversion at the time of release of this server version.
When changing this, note that older unsupported versions of the Nextcloud desktop client may not function as ex-
pected, and could lead to permanent data loss for clients or other unexpected results.
Defaults to 2.0.0
EXPERIMENTAL: option whether to include external storage in quota calculation, defaults to false.
Defaults to false
'filesystem_check_changes' => 0,
Specifies how often the local filesystem (the Nextcloud data/ directory, and NFS mounts in data/) is checked for
changes made outside Nextcloud. This does not apply to external storages.
0 -> Never check the filesystem for outside changes, provides a performance increase when it’s certain that no changes
are made directly to the filesystem
1 -> Check each file or folder at most once per request, recommended for general use if outside changes might happen.
Defaults to 0
By default Nextcloud will store the part files created during upload in the same storage as the upload target. Setting
this to false will store the part files in the root of the users folder which might be required to work with certain external
storage setups that have limited rename capabilities.
Defaults to true
'mount_file' => '/var/www/nextcloud/data/mount.json',
Where mount.json file should be stored, defaults to data/mount.json in the Nextcloud directory.
Defaults to data/mount.json in the Nextcloud directory.
'filesystem_cache_readonly' => false,
When true, prevent Nextcloud from changing the cache due to changes in the filesystem for all storage.
Defaults to false
'secret' => '',
Secret used by Nextcloud for various purposes, e.g. to encrypt data. If you lose this string there will be data corruption.
'trusted_proxies' => array('203.0.113.45', '198.51.100.128'),
Headers that should be trusted as client IP address in combination with trusted_proxies. If the HTTP header looks like
‘X-Forwarded-For’, then use ‘HTTP_X_FORWARDED_FOR’ here.
If set incorrectly, a client can spoof their IP address as visible to Nextcloud, bypassing access controls and making
logs useless!
Defaults to 'HTTP_X_FORWARED_FOR'
'max_filesize_animated_gifs_public_sharing' => 10,
This entry is just here to show a warning in case somebody copied the sample configuration. DO NOT ADD THIS
SWITCH TO YOUR CONFIGURATION!
If you, brave person, have read until here be aware that you should not modify ANY settings in this file without reading
the documentation.
set to true if the server is used in a setup based on Nextcloud’s Global Scale architecture
by default federation is only used internally in a Global Scale setup If you want to allow federation outside of your
environment set it to ‘global’
List of incompatible user agents opted out from Same Site Cookie Protection.
Some user agents are notorious and don’t really properly follow HTTP specifications. For those, have an opt-out.
WARNING: only use this if you know what you are doing
Every day a cron job is ran, which deletes all activities for all users which are older then the number of days that is set
for activity_expire_days
Nextcloud is capable of sending password reset emails, notifying users of new file shares, changes in files, and activity
notifications. Your users configure which notifications they want to receive on their Personal pages.
Nextcloud does not contain a full email server, but rather connects to your existing mail server. You must have a
functioning mail server for Nextcloud to be able to send emails. You may have a mail server on the same machine as
Nextcloud, or it may be a remote server.
With the new wizard, connecting Nextcloud to your mail server is fast and easy. The wizard fills in the values in
config/config.php, so you may use either or both as you prefer.
The Nextcloud Email wizard supports three types of mail server connections: SMTP, qmail, and Sendmail. Use the
SMTP configurator for a remote server or Sendmail when your mail server is on the same machine as Nextcloud.
Note: The Sendmail option refers to the Sendmail SMTP server and any drop-in Sendmail replacement such as
Postfix, Exim, or Courier. All of these include a sendmail binary, and are freely-interchangeable.
You need the following information from your mail server administrator to connect Nextcloud to a remote SMTP
server:
• Encryption type: None, SSL/TLS, or STARTTLS
• The From address you want your outgoing Nextcloud mails to use
• Whether authentication is required
• Authentication method: None, Login, Plain, or NT LAN Manager
• The server’s IP address or fully-qualified domain name and the SMTP port
• Login credentials (if required)
Your changes are saved immediately, and you can click the Send Email button to test your configuration. This sends a
test message to the email address you configured on your Personal page. The test message says:
--
Nextcloud
a safe home for all your data
Configuring Sendmail or qmail requires only that you select one of them instead of SMTP, and then enter your desired
return email address.
In most cases the SMTP option is best, since you will be able to control all of your mail server options in one place, in
your mail server configuration then.
We removed the template editor in Nextcloud 12 because we changed how emails are generated. While the customiza-
tion capabilities offered by the template editor were easy to use, they often resulted in broken emails. To fix this, we
designed a much easier mechanism that automatically generates emails which follow the theme settings and look the
same in all the different email clients out there.
Note: If, for some reason, you need text-only emails, consider simply configuring this on the client side or let the
receiving (or even sending) mail server drop the HTML part. Note that there is no security impact from sending HTML
emails, just from displaying them and thus any security risk can only be mitigated by disabling showing HTML on the
client (or removing the HTML part in the mail server).
You can now overwrite templates by writing a class that implements the template interface (or extends it to not need
to copy over everything). Easiest way is then put this class into an app and load it (so you do not need to patch it on
every update).
This is the interface of the class that needs to be implemented: https://github.com/nextcloud/server/blob/master/lib/
public/Mail/IEMailTemplate.php
That is the implementation that could be extended and used to see how it works: https://github.com/nextcloud/server/
blob/master/lib/private/Mail/EMailTemplate.php
An example from a GitHub issue:
1. Look at the source code of extended class OCMailEMailTemplate::class
2. Then override what you need in your own OCMailEMailTemplate::class extension
Example:
Let’s assume that we need to override the email header:
<?php
namespace \OCA\MyApp;
use OC\Mail\EMailTemplate;
You will find a detailed step by step guide in our support portal.
If you prefer, you may set your mail server parameters in config/config.php. The following examples are for
SMTP, PHP, Sendmail, and Qmail.
SMTP
If you want to send email using a local or remote SMTP server it is necessary to enter the name or IP address of the
server, optionally followed by a colon separated port number, e.g. :425. If this value is not given the default port
25/tcp will be used unless you change that by modifying the mail_smtpport parameter.
<?php
or
<?php
If a malware or SPAM scanner is running on the SMTP server it might be necessary that you increase the SMTP
timeout to e.g. 30s:
<?php
If the SMTP server accepts insecure connections, the default setting can be used:
<?php
If the SMTP server only accepts secure connections you can choose between the following two variants:
SSL
A secure connection will be initiated using the outdated SMTPS protocol which uses the port 465/tcp:
<?php
TLS
A secure connection will be initiated using the STARTTLS protocol which uses the default port 25/tcp:
<?php
And finally it is necessary to configure if the SMTP server requires authentication, if not, the default values can be
taken as is.
<?php
If SMTP authentication is required you have to set the required username and password and can optionally choose
between the authentication types LOGIN (default) or PLAIN.
<?php
Sendmail
If you want to use the well known Sendmail program to send email, it is necessary to have an installed and working
email system on your *nix server. The sendmail binary (/usr/sbin/sendmail) is usually part of that system. Nextcloud
should be able to send email out of the box.
<?php
qmail
If you want to use the qmail program to send email, it is necessary to have an installed and working qmail email system
on your server. The qmail binary installed on your server will then be used to send email. Nextcloud should be able to
send email out of the box.
<?php
To test your email configuration, save your email address in your personal settings and then use the Send email button
in the Email Server section of the Admin settings page.
4.7.6 Troubleshooting
If you are unable to send email, try turning on debugging. Do this by enabling the mail_smtpdebug parameter
in config/config.php.
<?php
Note: Immediately after pressing the Send email button, as described before, several SMTP -> get_lines(): . . .
messages appear on the screen. This is expected behavior and can be ignored.
<?php
This setting results in every email sent by Nextcloud (for example, the password reset email) having the domain part
of the sender address appear as follows:
ping smtp.server.dom
Question: How can I find out if the SMTP server is listening on a specific TCP port?
Answer: The best way to get mail server information is to ask your mail server admin. If you are the mail server
admin, or need information in a hurry, you can use the netstat command. This example shows all active servers on
your system, and the ports they are listening on. The SMTP server is listening on localhost port 25.
# netstat -pant
Question: How can I determine if the SMTP server supports the outdated SMTPS protocol?
Answer: A good indication that the SMTP server supports the SMTPS protocol is that it is listening on port 465.
Question: How can I determine what authorization and encryption protocols the mail server supports?
Answer: SMTP servers usually announce the availability of STARTTLS immediately after a connection has been
established. You can easily check this using the telnet command.
Note: You must enter the marked lines to obtain the information displayed.
telnet smtp.domain.dom 25
Trying 192.168.1.10...
Connected to smtp.domain.dom.
Escape character is '^]'.
220 smtp.domain.dom ESMTP Exim 4.80.1 Tue, 22 Jan 2013 22:39:55 +0100
EHLO your-server.local.lan # <<< enter this command
250-smtp.domain.dom Hello your-server.local.lan [ip-address]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-AUTH PLAIN LOGIN CRAM-MD5 # <<< Supported auth protocols
250-STARTTLS # <<< Encryption is supported
250 HELP
QUIT # <<< enter this command
221 smtp.domain.dom closing connection
Connection closed by foreign host.
If you are unable to send email, it might be useful to activate further debug messages by enabling the mail_smtpdebug
parameter:
<?php
Note: Immediately after pressing the Send email button, as described before, several SMTP -> get_lines(): . . .
messages appear on the screen. This is expected behavior and can be ignored.
You can embed external websites or documents inside your Nextcloud pages with the External sites app, as this
screenshot shows.
This is useful for quick access to important pages such as the Nextcloud manuals and informational pages for your
company, and for presenting external pages inside your custom Nextcloud branding, if you use your own custom
themes.
The External sites app can be easily installed from the app store. Go to Settings > Apps > Customization to enable
it. Then go to your Nextcloud Settings > Administration > External sites to create your links, which are saved
automatically.
Each link can have a unique icon, which can be uploaded in the admin settings. If you select a language, the link will
only be displayed for users with the selected language. This allows you to have different documentation links for users
depending on their language.
It is also possible to add links for a special device (recognized by the user agent). Currently the following options are
available: All devices, Android app, iOS app, Desktop client and all others (Browsers).
Starting with Nextcloud 13, it is also possible to add links only for members of a given group.
The links appear in the Nextcloud menu on the top or in the settings menu, after reloading the page.
Your links may or may not work correctly due to the various ways that Web browsers and Web sites handle HTTP
and HTTPS URLs, and because the External Sites app embeds external links in IFrames. Modern Web browsers try
very hard to protect Web surfers from dangerous links, and safety apps like Privacy Badger and ad-blockers may block
embedded pages. It is strongly recommended to enforce HTTPS on your Nextcloud server; do not weaken this, or
any of your security tools, just to make embedded Web pages work. After all, you can freely access them outside of
Nextcloud.
Most Web sites that offer login functionalities use the X-Frame-Options or Content-Security-Policy
HTTP header which instructs browsers to not allow their pages to be embedded for security reasons (e.g. “Clickjack-
ing”). You can usually verify the reason why embedding the website is not possible by using your browser’s console
tool. For example, this page has an invalid SSL certificate.
New: With Nextcloud 13 a redirect option was added, so such websites can still be added for quick access. Instead of
embedding the website the user will be redirected to it instead.
In normal cases Nextcloud will automatically detect the language of the Web-GUI. If this does not work properly or
you want to make sure that Nextcloud always starts with a given language, you can set a default_language parameter
in the config/config.php.
Note: The default_language paramenter is only used, when the browser does not send any language, and the user
hasn’t configured own language preferences.
<?php
If you want to force a specific language, users will no longer be able to change their language in the personal settings.
You can set a force_language parameter in the config/config.php.
<?php
If users shall be unable to change their language, but users have different languages, this value can be set to true
instead of a language code.
Note: Please check Transifex language codes for the list of valid language codes.
Use your Nextcloud log to review system status, or to help debug problems. You may adjust logging levels, and choose
between using the Nextcloud log or your syslog.
4.10.1 Parameters
Logging levels range from DEBUG, which logs all activity, to FATAL, which logs only fatal errors.
• 0: DEBUG: All activity; the most detailed logging.
• 1: INFO: Activity such as user logins and file activities, plus warnings, errors, and fatal errors.
• 2: WARN: Operations succeed, but with warnings of potential problems, plus errors and fatal errors.
• 3: ERROR: An operation fails, but other services and operations continue, plus fatal errors.
• 4: FATAL: The server stops.
By default the log level is set to 2 (WARN). Use DEBUG when you have a problem to diagnose, and then reset your
log level to a less-verbose level as DEBUG outputs a lot of information, and can affect your server performance.
Logging level parameters are set in the config/config.php file, or on the Admin page of your Nextcloud Web
GUI.
Nextcloud
All log information will be written to a separate log file which can be viewed using the log viewer on your Admin
page. By default, a log file named nextcloud.log will be created in the directory which has been configured by the
datadirectory parameter in config/config.php.
The desired date format can optionally be defined using the logdateformat parameter in config/config.php.
By default the PHP date function parameter “c” is used, and therefore the date/time is written in the format “2013-
01-10T15:20:25+02:00”. By using the date format in the example below, the date/time format will be written in the
format “January 10, 2013 15:20:25”.
syslog
Nextcloud aims to ship with secure defaults that do not need to get modified by administrators. However, in some
cases some additional security hardening can be applied in scenarios were the administrator has complete control over
the Nextcloud instance. This page assumes that you run Nextcloud Server on Apache2 in a Linux environment.
Note: Nextcloud will warn you in the administration interface if some critical security-relevant options are missing.
However, it is still up to the server administrator to review and maintain system security.
Nextcloud uses the bcrypt algorithm, and thus for security and performance reasons, e.g. Denial of Service as CPU
demand increases exponentially, it only verifies the first 72 characters of passwords. This applies to all passwords that
you use in Nextcloud: user passwords, passwords on link shares, and passwords on external shares.
Nextcloud uses a RFC 4086 (“Randomness Requirements for Security”) compliant mixer to generate cryptographically
secure pseudo-random numbers. This means that when generating a random number Nextcloud will request multiple
random numbers from different sources and derive from these the final random number.
The random number generation also tries to request random numbers from /dev/urandom, thus it is highly recom-
mended to configure your setup in such a way that PHP is able to read random data from it.
Note: When having an open_basedir configured within your php.ini file, make sure to include /dev/
urandom.
It is highly recommended to enable hardening modules such as SELinux where possible. See SELinux configuration
to learn more about SELinux.
4.11.3 Deployment
It is highly recommended to place your data directory outside of the Web root (i.e. outside of /var/www). It is easiest
to do this on a new installation.
Nextcloud is able to generate preview images of common filetypes such as images or text files. By default the preview
generation for some file types that we consider secure enough for deployment is enabled by default. However, admin-
istrators should be aware that these previews are generated using PHP libraries written in C which might be vulnerable
to attack vectors.
For high security deployments we recommend disabling the preview generation by setting the enable_previews
switch to false in config.php. As an administrator you are also able to manage which preview providers are
enabled by modifying the enabledPreviewProviders option switch.
Using Nextcloud without using an encrypted HTTPS connection opens up your server to a man-in-the-middle (MITM)
attack, and risks the interception of user data and passwords. It is a best practice, and highly recommended, to always
use HTTPS on production servers, and to never allow unencrypted HTTP.
How to setup HTTPS on your Web server depends on your setup; please consult the documentation for your HTTP
server. The following examples are for Apache.
To redirect all HTTP traffic to HTTPS administrators are encouraged to issue a permanent redirect using the 301
status code. When using Apache this can be achieved by a setting such as the following in the Apache VirtualHosts
configuration:
<VirtualHost *:80>
ServerName cloud.nextcloud.com
Redirect permanent / https://cloud.nextcloud.com/
</VirtualHost>
While redirecting all traffic to HTTPS is good, it may not completely prevent man-in-the-middle attacks. Thus ad-
ministrators are encouraged to set the HTTP Strict Transport Security header, which instructs browsers to not allow
any connection to the Nextcloud instance using HTTP, and it attempts to prevent site visitors from bypassing invalid
certificate warnings.
This can be achieved by setting the following settings within the Apache VirtualHost file:
<VirtualHost *:443>
ServerName cloud.nextcloud.com
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains
˓→"
</IfModule>
</VirtualHost>
Warning: We recommend the additional setting ; preload to be added to that header. Then the domain will
be added to an hardcoded list that is shipped with all major browsers and enforce HTTPS upon those domains.
See the HSTS preload website for more information. Due to the policy of this list you need to add it to the above
example for yourself once you are sure that this is what you want. Removing the domain from this list could take
some months until it reaches all installed browsers.
This example configuration will make all subdomains only accessible via HTTPS. If you have subdomains not acces-
sible via HTTPS, remove includeSubdomains;.
This requires the mod_headers extension in Apache.
Default SSL configurations by Web servers are often not state-of-the-art, and require fine-tuning for an optimal perfor-
mance and security experience. The available SSL ciphers and options depend completely on your environment and
thus giving a generic recommendation is not really possible.
We recommend using the Mozilla SSL Configuration Generator to generate a suitable configuration suited for your
environment, and the free Qualys SSL Labs Tests gives good guidance on whether your SSL server is correctly
configured.
Also ensure that HTTP compression is disabled to mitigate the BREACH attack.
Administrators are encouraged to install Nextcloud on a dedicated domain such as cloud.domain.tld instead of do-
main.tld to gain all the benefits offered by the Same-Origin-Policy.
As Nextcloud supports features such as Federated File Sharing we do not consider Server Side Request Forgery
(SSRF) part of our threat model. In fact, given all our external storage adapters this can be considered a feature and
not a vulnerability.
This means that a user on your Nextcloud instance could probe whether other hosts are accessible from the Nextcloud
network. If you do not want this you need to ensure that your Nextcloud is properly installed in a segregated network
and proper firewall rules are in place.
Basic security headers are served by Nextcloud already in a default environment. These include:
• X-Content-Type-Options: nosniff
– Instructs some browsers to not sniff the mimetype of files. This is used for example to prevent
browsers from interpreting text files as JavaScript.
• X-XSS-Protection: 1; mode=block
– Instructs browsers to enable their browser side Cross-Site-Scripting filter.
• X-Robots-Tag: none
– Instructs search machines to not index these pages.
• X-Frame-Options: SAMEORIGIN
– Prevents embedding of the Nextcloud instance within an iframe from other domains to prevent Click-
jacking and other similar attacks.
• Referrer-Policy: no-referrer
– The default no-referrer policy instructs the browser not to send referrer information along with re-
quests to any origin.
These headers are hard-coded into the Nextcloud server, and need no intervention by the server administrator.
For optimal security, administrators are encouraged to serve these basic HTTP headers by the Web server to enforce
them on response. To do this Apache has to be configured to use the .htaccess file and the following Apache
modules need to be enabled:
• mod_headers
• mod_env
Administrators can verify whether this security change is active by accessing a static resource served by the Web server
and verify that the above mentioned security headers are shipped.
Nextcloud can be run through a reverse proxy, which can cache static assets such as images, CSS or JS files, move the
load of handling HTTPS to a different server or load balance between multiple servers.
For security, you must explicitly define the proxy servers that Nextcloud is to trust. Connections from trusted proxies
will be specially treated to get the real client information, for use in access control and logging. Parameters are
configured in config/config.php
Set the trusted_proxies parameter as an array of IP address to define the servers Nextcloud should trust as proxies.
This parameter provides protection against client spoofing, and you should secure those servers as you would your
Nextcloud server.
A reverse proxy can define HTTP headers with the original client IP address, and Nextcloud can use those headers
to retrieve that IP address. Nextcloud uses the de-facto standard header ‘X-Forwarded-For’ by default, but this can
be configured with the forwarded_for_headers parameter. This parameter is an array of PHP lookup strings, for
example ‘X-Forwarded-For’ becomes ‘HTTP_X_FORWARDED_FOR’. Incorrectly setting this parameter may allow
clients to spoof their IP address as visible to Nextcloud, even when going through the trusted proxy! The correct value
for this parameter is dependent on your proxy software.
The automatic hostname, protocol or webroot detection of Nextcloud can fail in certain reverse proxy situations. This
configuration allows the automatic detection to be manually overridden.
If Nextcloud fails to automatically detect the hostname, protocol or webroot you can use the overwrite parameters
inside the config/config.php. The overwritehost parameter is used to set the hostname of the proxy. You can
also specify a port. The overwriteprotocol parameter is used to set the protocol of the proxy. You can choose between
the two options http and https. The overwritewebroot parameter is used to set the absolute web path of the proxy
to the Nextcloud folder. When you want to keep the automatic detection of one of the three parameters you can leave
the value empty or don’t set it. The overwritecondaddr parameter is used to overwrite the values dependent on the
remote address. The value must be a regular expression of the IP addresses of the proxy. This is useful when you use
a reverse SSL proxy only for https access and you want to use the automatic detection for http access.
4.12.3 Example
If you want to access your Nextcloud installation http://domain.tld/nextcloud via a multiple domains reverse SSL
proxy https://ssl-proxy.tld/domain.tld/nextcloud with the IP address 10.0.0.1 you can set the following parameters
inside the config/config.php.
<?php
$CONFIG = array (
'trusted_proxies' => ['10.0.0.1'],
'overwritehost' => 'ssl-proxy.tld',
'overwriteprotocol' => 'https',
'overwritewebroot' => '/domain.tld/nextcloud',
'overwritecondaddr' => '^10\.0\.0\.1$',
);
Note: If you want to use the SSL proxy during installation you have to create the config/config.php otherwise
you have to extend the existing $CONFIG array.
Nextcloud uses some third party PHP components to provide some of its functionality. These components are part of
the software package and are contained in the /3rdparty folder.
When using third party components, keep the following parameters in mind:
• 3rdpartyroot – Specifies the location of the 3rd-party folder. To change the default location of this folder, you
can use this parameter to define the absolute file system path to the folder location.
• 3rdpartyurl – Specifies the http web path to the 3rdpartyroot folder, starting at the Nextcloud web root.
An example of what these parameters might look like is as follows:
<?php
If you need to install Nextcloud on multiple servers, you normally do not want to set up each instance separately as
described in Database configuration. For this reason, Nextcloud provides an automatic configuration feature.
To take advantage of this feature, you must create a configuration file, called ../nextcloud/config/
autoconfig.php, and set the file parameters as required. You can specify any number of parameters in this
file. Any unspecified parameters appear on the “Finish setup” screen when you first launch Nextcloud.
The ../nextcloud/config/autoconfig.php is automatically removed after the initial configuration has
been applied.
4.14.1 Parameters
When configuring parameters, you must understand that two parameters are named differently in this configuration
file when compared to the standard config.php file.
autoconfig.php config.php
directory datadirectory
dbpass dbpassword
The following sections provide sample automatic configuration examples and what information is requested at the end
of the configuration.
Data Directory
Using the following parameter settings, the “Finish setup” screen requests database and admin credentials settings.
<?php
$AUTOCONFIG = array(
"directory" => "/www/htdocs/nextcloud/data",
);
SQLite database
Using the following parameter settings, the “Finish setup” screen requests data directory and admin credentials set-
tings.
<?php
$AUTOCONFIG = array(
"dbtype" => "sqlite",
"dbname" => "nextcloud",
"dbtableprefix" => "",
);
MySQL database
Using the following parameter settings, the “Finish setup” screen requests data directory and admin credentials set-
tings.
<?php
$AUTOCONFIG = array(
"dbtype" => "mysql",
"dbname" => "nextcloud",
"dbuser" => "username",
"dbpass" => "password",
"dbhost" => "localhost",
"dbtableprefix" => "",
);
Note: Keep in mind that the automatic configuration does not eliminate the need for creating the database user and
database in advance, as described in Database configuration.
PostgreSQL database
Using the following parameter settings, the “Finish setup” screen requests data directory and admin credentials set-
tings.
<?php
$AUTOCONFIG = array(
"dbtype" => "pgsql",
"dbname" => "nextcloud",
"dbuser" => "username",
"dbpass" => "password",
"dbhost" => "localhost",
"dbtableprefix" => "",
);
Note: Keep in mind that the automatic configuration does not eliminate the need for creating the database user and
database in advance, as described in Database configuration.
All parameters
Using the following parameter settings, because all parameters are already configured in the file, the Nextcloud instal-
lation skips the “Finish setup” screen.
<?php
$AUTOCONFIG = array(
"dbtype" => "mysql",
"dbname" => "nextcloud",
"dbuser" => "username",
"dbpass" => "password",
"dbhost" => "localhost",
"dbtableprefix" => "",
"adminlogin" => "root",
"adminpass" => "root-password",
Note: Keep in mind that the automatic configuration does not eliminate the need for creating the database user and
database in advance, as described in Database configuration.
High system load will slow down Nextcloud and might also lead to other unwanted side effects. To reduce load you
should first identify the source of the problem. Tools such as htop, iotop or glances will help to identify the process
or the drive that slows down your system. First you should make sure that you installed/assigned enough RAM. Swap
usage should be prevented by all means. If you run your database inside a VM, you should not store it inside a VM
image file. Better put it on a dedicated block device to reduce latency due to multiple abstraction layers.
4.15.3 Caching
Caching improves performance by storing data, code, and other objects in memory. Memory cache configuration for
the Nextcloud server must be installed and configured. See Configuring memory caching.
MySQL or MariaDB are preferred because of the performance limitations of SQLite with highly concurrent applica-
tions, like Nextcloud.
See the section Database configuration for how to configure Nextcloud for MySQL or MariaDB. If your installation is
already running on SQLite then it is possible to convert to MySQL or MariaDB using the steps provided in Converting
database type.
In smaller installations you might not want to set up a separate cache. However you can still tune your database. The
following example is suited for a database smaller than 1GB. MySQL will consume up to 1GB of RAM for caching.
Please make sure that your system has sufficient free RAM after the change, so that it does not start to use your swap
partition, when it receives a burst of requests. In the given example your /etc/mysql/conf.d/mysql.cnf
might contain the following lines. (beware that this is the block for mysqld not mysql)
[mysqld]
innodb_buffer_pool_size=1G
innodb_io_capacity=4000
File locking is enabled by default, using the database locking backend. This places a significant load on your database.
See the section Transactional file locking for how to configure Nextcloud to use Redis-based Transactional File Lock-
ing.
SSL (HTTPS) and file encryption/decryption can be offloaded to a processor’s AES-NI extension. This can both speed
up these operations while lowering processing overhead. This requires a processor with the AES-NI instruction set.
Here are some examples how to check if your CPU / environment supports the AES-NI extension:
• For each CPU core present: grep flags /proc/cpuinfo or as a summary for all cores: grep -m 1
^flags /proc/cpuinfo If the result contains any aes, the extension is present.
• Search eg. on the Intel web if the processor used supports the extension Intel Processor Feature Filter You may
set a filter by "AES New Instructions" to get a reduced result set.
• For versions of openssl >= 1.0.1, AES-NI does not work via an engine and will not show up in the openssl
engine command. It is active by default on the supported hardware. You can check the openssl version via
openssl version -a
• If your processor supports AES-NI but it does not show up eg via grep or coreinfo, it is maybe disabled in the
BIOS.
• If your environment runs virtualized, check the virtualization vendor for support.
HTTP2 has huge speed improvements over HTTP with multiple request. Most browsers already support HTTP2 over
SSL (HTTPS). So refer to your server manual for guides on how to use HTTP2.
If you are using a default installation of php-fpm you might have noticed excessive load times on the web interface
or even sync issues. This is due to the fact that each simultaneous request of an element is handled by a separate
PHP-FPM process. So even on a small installation you should allow more processes to run. For example on a machine
with 4GB of RAM and 1GB of MySQL cache following values in your www.conf file should work:
pm = dynamic
pm.max_children = 120
pm.start_servers = 12
pm.min_spare_servers = 6
pm.max_spare_servers = 18
Depending on your current PHP version you should find this file e.g. under /etc/php/7.2/fpm/pool.d/www.
conf
The OPcache improves the performance of PHP applications by caching precompiled bytecode. We recommend at
least following settings:
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1
For more details check out the official documentation or this blog post about some recommended settings.
4.16 Theming
With our theming feature you are able to customize the look and feel of your Nextcloud instance according to the
corporate design of your organization by replacing Nextcloud logo and color with your own assets.
The theming-app is enabled by default so the section should appear by default in your admin-settings. If not, check in
the apps management that this app is enabled.
You can change the following parameters of the look and feel on your instance:
• Name (e.g. ACME Inc. Cloud)
• Web Address (e.g. https://acme.inc/)
• Slogan
• Color: The color of header bar, checkboxes and folder icon
• Logo: The logo will appear in the header and on the log in page. Default has 62/34 px.
• Login image: The background image of the login page
• Additional legal links (Legal notice and Privacy policy link)
• Custom header logo and favicon as alternative to auto-generation based on logo
According to the parameters you have set, Nextcloud will automatically generate favicons and a header logo depending
on the current logo and theming color.
This requires the following additional dependencies:
• PHP module imagick
• SVG support for imagick (e.g. libmagickcore5-extra)
Note: In the advanced options of the theming-app you are able to set a custom favicon in case you do not want to use
the same logo resources you have set above or you do not want to install the mentioned dependencies.
Note: Nextcloud GmbH provides branding services, delivering sync clients (mobile and desktop) which use your
corporate identity and are pre-configured to help your users get up and running in no time. If you are interested in our
advanced branding & support subscription, contact our sales team.
The theming-app supports to change the URLs to the mobile apps (Android & iOS) that is shown when the webinter-
face is opened on one of those devices. Then there was a header shown, that redirects the user to the app in the app
store. By default this redirects to the Nextcloud apps. In some cases it is wanted that this links to branded versions of
those apps. In those cases the IDs and URLs can be set via the occ-command:
occ config:app:set theming AndroidClientUrl --value "https://play.google.com/store/
˓→apps/details?id=com.nextcloud.client"
4.17 OAuth2
Nextcloud allows connecting external services (for example Moodle) to your Nextcloud. This is done via OAuth2.
See RFC6749 for the OAuth2 specification.
Head over to your Administrator Security Settings. Here you can add a new OAuth2 client.
Enter the name of your application and provide a redirection url. You should now have a Client Identifier and Secret.
Enter those into your OAuth2 client.
Please provide the OAuth2 application the following details:
Authorization endpoint: SERVER/apps/oauth2/authorize Token endpoint: SERVER/apps/oauth2/api/v1/token
Note that the SERVER portion must include index.php at the end if pretty URL is not configured.
The access token obtained is a so called Bearer token. Which means that for request to the Nextcloud server you will
have to send the proper authorization header.
FIVE
USER MANAGEMENT
The Group filters on the left sidebar lets you quickly filter users by their group memberships, and create new groups.
121
Nextcloud Server Administration Manual, Release 14
Click the gear icon on the lower left sidebar to set a default storage quota, and to display additional fields: Show
storage location, Show last log in, Show user backend, Send email to new users, and Show email address.
Full Name The user’s display name that appears on file shares, the Nextcloud Web interface, and emails. Admins and
users may change the Full Name anytime. If the Full Name is not set it defaults to the login name.
Password The admin sets the new user’s first password. Both the user and the admin can change the user’s password
at anytime.
Groups You may create groups, and assign group memberships to users. By default new users are not assigned to any
groups.
Group Admin Group admins are granted administrative privileges on specific groups, and can add and remove users
from their groups.
Quota The maximum disk space assigned to each user. Any user that exceeds the quota cannot upload or sync data.
You have the the option to include external storage in user quotas.
Login names may contain letters (a-z, A-Z), numbers (0-9), dashes (-), underscores (_), periods (.) and at signs (@).
After creating the user, you may fill in their Full Name if it is different than the login name, or leave it for the user to
complete.
If you have checked Send email to new user in the control panel on the lower left sidebar, you may also enter the new
user’s email address, and Nextcloud will automatically send them a notification with their new login information. You
may edit this email using the email template editor on your Admin page (see Email configuration).
Set the Send email to new user-checkbox allows you to leave the Password field empty. The user will get an
activation-email to set his own password.
You cannot recover a user’s password, but you can set a new one:
• Hover your cursor over the user’s Password field
• Click on the pencil icon
• Enter the user’s new password in the password field, and remember to provide the user with their password
If you have encryption enabled, there are special considerations for user password resets. Please see Encryption
configuration.
Each Nextcloud user has two names: a unique Login Name used for authentication, and a Full Name, which is their
display name. You can edit the display name of a user, but you cannot change the login name of any user.
To set or change a user’s display name:
• Hover your cursor over the user’s Full Name field
• Click on the Pencil icon
• Enter the user’s new display name
Nextcloud has two types of administrators: Super Administrators and Group Administrators. Group administrators
have the rights to create, edit and delete users in their assigned groups. Group administrators cannot access system
settings, or add or modify users in the groups that they are not Group Administrators for. Use the dropdown menus
in the Group Admin column to assign group admin privileges.
Super Administrators have full rights on your Nextcloud server, and can access and modify all settings. To assign
the Super Administrators role to a user, simply add them to the admin group.
You can assign new users to groups when you create them, and create new groups when you create new users. You may
also use the Add Group button at the top of the left pane to create new groups. New group members will immediately
have access to file shares that belong to their new groups.
Click the gear on the lower left pane to set a default storage quota. This is automatically applied to new users. You
may assign a different quota to any user by selecting from the Quota dropdown, selecting either a preset value or
entering a custom value. When you create custom quotas, use the normal abbreviations for your storage values such
as 500 MB, 5 GB, 5 TB, and so on.
You now have a configurable option in config.php that controls whether external storage is counted against user’s
quotas. This is still experimental, and may not work as expected. The default is to not count external storage as part
of user storage quotas. If you prefer to include it, then change the default false to true.:
Metadata (such as thumbnails, temporary files, and encryption keys) takes up about 10% of disk space, but is not
counted against user quotas. Users can check their used and available space on their Personal pages. Only files that
originate with users count against their quotas, and not files shared with them that originate from other users. For
example, if you upload files to a different user’s share, those files count against your quota. If you re-share a file that
another user shared with you, that file does not count against your quota, but the originating user’s.
Encrypted files are a little larger than unencrypted files; the unencrypted size is calculated against the user’s quota.
Deleted files that are still in the trash bin do not count against quotas. The trash bin is set at 50% of quota. Deleted
file aging is set at 30 days. When deleted files exceed 50% of quota then the oldest files are removed until the total is
below 50%.
When version control is enabled, the older file versions are not counted against quotas.
When a user creates a public share via URL, and allows uploads, any uploaded files count against that user’s quota.
Sometimes you may want to disable a user without permanently deleting his settings and files. The user can be
activated any time again, without data-loss.
Hover your cursor over their name on the Users page until the “. . . ”-menu icon appears at the far right. After clicking
on it, you will see the Disable option.
The user will not longer be able to access his Nextcloud until you enable him again. Keep in mind that the files, which
were shared by this user will not longer be accessible.
You will find all disabled users in the disabled-section on the left pane. Enabling users is as easy as disabling them.
Just click on the “. . . ”-menu, and select Enable.
Deleting a user is easy: hover your cursor over their name on the Users page until the “. . . ”-menu icon appears at the
far right. After clicking on it, you will see the Delete option. Clicking on it, delets a user with all his data immediately.
You’ll see an undo button at the top of the page, which remains for some seconds. When the undo button is gone you
cannot recover the deleted user.
All of the files owned by the user are deleted as well, including all files they have shared. If you need to preserve the
user’s files and shares, you must first download them from your Nextcloud Files page, which compresses them into a
zip file, or use a sync client to copy them to your local computer. See File Sharing to learn how to create persistent file
shares that survive user deletions.
If your Nextcloud username is not admin, then substitute your Nextcloud username.
You can find your HTTP user in your HTTP configuration file. These are the default Apache HTTP user:group on
Linux distros:
• Centos, Red Hat, Fedora: apache:apache
• Debian, Ubuntu, Linux Mint: www-data:www-data
• openSUSE: wwwrun:www
See Using the occ command to learn more about using the occ command.
The Nextcloud login screen displays a Wrong password. Reset it? message after a user enters an incorrect password,
and then Nextcloud automatically resets their password. However, if you are using a read-only authentication backend
such as LDAP or Active Directory, this will not work. In this case you may specify a custom URL in your config.
php file to direct your user to a server than can handle an automatic reset:
A password policy is a set of rules designed to enhance computer security by encouraging users to employ strong
passwords and use them properly.
In the security-section of your administrator-settings you can configure
• a minimal length of a password. Default is 10 characters.
• to forbid common passwords like ‘password’ or ‘login’.
• to enforce upper and lower case characters
• to enforce numeric characters
• to enforce special characters like ! or :
• to check the password against the list of breached passwords from haveibeenpwnd.com (hashed check via
haveibeenpwnd.com-API)
Starting with Nextcloud 10, it is possible to use two factor authentication (2FA) with Nextcloud. It is a plugin based
system requiring a 2FA app. Several 2FA apps are already available including TOTP, SMS 2-factor and U2F. Devel-
opers can built new two-factor provider apps.
You can enable 2FA by installing and enabling a 2FA app like TOTP which works with Google Authenticator and
compatible apps. The apps are available in the Nextcloud App store so by navigating there and clicking enable for the
app you want, 2FA will be installed and enabled on your Nextcloud server.
Once 2FA has been enabled, users have to activate it in their personal settings.
You may configure additional user backends in Nextcloud’s configuration config/config.php using the follow-
ing syntax:
<?php
Note: A non-blocking or correctly configured SELinux setup is needed for these backends to work. Please refer to
the SELinux configuration.
Currently the “External user support” (user_external) app, which you need to enable first (See Installing and managing
apps) provides the following user backends:
5.6.1 IMAP
<?php
5.6.2 SMB
<?php
5.6.3 FTP
<?php
Nextcloud ships with an LDAP application to allow LDAP users (including Active Directory) to appear in your
Nextcloud user listings. These users will authenticate to Nextcloud with their LDAP credentials, so you don’t have to
create separate Nextcloud user accounts for them. You will manage their Nextcloud group memberships, quotas, and
sharing permissions just like any other Nextcloud user.
Note: The PHP LDAP module is required; this is supplied by php-ldap on most distributions.
Note: A non-blocking or correctly configured SELinux setup is needed for the LDAP backend to work. Please refer
to the SELinux configuration.
5.7.1 Configuration
First enable the LDAP user and group backend app on the Apps page in Nextcloud. Then go to your Admin
page to configure it.
The LDAP configuration panel has four tabs. A correctly completed first tab (“Server”) is mandatory to access the
other tabs. A green indicator lights when the configuration is correct. Hover your cursor over the fields to see some
pop-up tooltips.
Server tab
Start with the Server tab. You may configure multiple servers if you have them. At a minimum you must supply the
LDAP server’s hostname. If your server requires authentication, enter your credentials on this tab. Nextcloud will then
attempt to auto-detect the server’s port and base DN. The base DN and port are mandatory, so if Nextcloud cannot
detect them you must enter them manually.
Server configuration: Configure one or more LDAP servers. Click the Delete Configuration button to remove the
active configuration.
Host: The host name or IP address of the LDAP server. It can also be a ldaps:// URI. If you enter the port number, it
speeds up server detection.
Examples:
• directory.my-company.com
• ldaps://directory.my-company.com
• directory.my-company.com:9876
Port: The port on which to connect to the LDAP server. The field is disabled in the beginning of a new configuration.
If the LDAP server is running on a standard port, the port will be detected automatically. If you are using a
non-standard port, Nextcloud will attempt to detect it. If this fails you must enter the port number manually.
Example:
• 389
User DN: The name as DN of a user who has permissions to do searches in the LDAP directory. Leave it empty for
anonymous access. We recommend that you have a special LDAP system user for this.
Example:
• uid=nextcloudsystemuser,cn=sysusers,dc=my-company,dc=com
Password: The password for the user given above. Empty for anonymous access.
Base DN: The base DN of LDAP, from where all users and groups can be reached. You may enter multiple base
DNs, one per line. (Base DNs for users and groups can be set in the Advanced tab.) This field is mandatory.
Nextcloud attempts to determine the Base DN according to the provided User DN or the provided Host, and you
must enter it manually if Nextcloud does not detect it.
Example:
• dc=my-company,dc=com
Users tab
Use this to control which LDAP users are listed as Nextcloud users on your Nextcloud server. In order to control
which LDAP users can login to your Nextcloud server use the Login Attributes tab. Those LDAP users who have
access but are not listed as users (if there are any) will be hidden users. You may bypass the form fields and enter a
raw LDAP filter if you prefer.
Only those object classes: Nextcloud will determine the object classes that are typically available for user objects in
your LDAP. Nextcloud will automatically select the object class that returns the highest amount of users. You
may select multiple object classes.
Only from those groups: If your LDAP server supports the member-of-overlay in LDAP filters, you can define
that only users from one or more certain groups are allowed to appear in user listings in Nextcloud. By default,
no value will be selected. You may select multiple groups.
If your LDAP server does not support the member-of-overlay in LDAP filters, the input field is disabled.
Please contact your LDAP administrator.
Edit LDAP Query: Clicking on this text toggles the filter mode and you can enter the raw LDAP filter directly.
Example:
(&(objectClass=inetOrgPerson)(memberOf=cn=nextcloudusers,ou=groups,
dc=example,dc=com))
x users found: This is an indicator that tells you approximately how many users will be listed in Nextcloud. The
number updates automatically after any changes.
The settings in the Login Attributes tab determine which LDAP users can log in to your Nextcloud system and which
attribute or attributes the provided login name is matched against (e.g. LDAP/AD username, email address). You may
select multiple user details. (You may bypass the form fields and enter a raw LDAP filter if you prefer.)
You may override your User Filter settings on the Users tab by using a raw LDAP filter.
LDAP Username: If this value is checked, the login value will be compared to the username in the LDAP directory.
The corresponding attribute, usually uid or samaccountname will be detected automatically by Nextcloud.
LDAP Email Address: If this value is checked, the login value will be compared to an email address in the LDAP
directory; specifically, the mailPrimaryAddress and mail attributes.
Other Attributes: This multi-select box allows you to select other attributes for the comparison. The list is generated
automatically from the user object attributes in your LDAP server.
Edit LDAP Query: Clicking on this text toggles the filter mode and you can enter the raw LDAP filter directly.
The %uid placeholder is replaced with the login name entered by the user upon login.
Examples:
• only username:
(&(objectClass=inetOrgPerson)(memberOf=cn=nextcloudusers,ou=groups,
dc=example,dc=com)(uid=%uid)
((&(objectClass=inetOrgPerson)(memberOf=cn=nextcloudusers,ou=groups,
dc=example,dc=com)(|(uid=%uid)(mail=%uid)))
Groups tab
By default, no LDAP groups will be available in Nextcloud. The settings in the Groups tab determine which groups
will be available in Nextcloud. You may also elect to enter a raw LDAP filter instead.
Only these object classes: Nextcloud will determine the object classes that are typically available for group objects
in your LDAP server. Nextcloud will only list object classes that return at least one group object. You can select
multiple object classes. A typical object class is “group”, or “posixGroup”.
Only from these groups: Nextcloud will generate a list of available groups found in your LDAP server. Then you
select the group or groups that get access to your Nextcloud server.
Edit LDAP Query: Clicking on this text toggles the filter mode and you can enter the raw LDAP filter directly.
Example:
• objectClass=group
• objectClass=posixGroup
y groups found: This tells you approximately how many groups will be available in Nextcloud. The number updates
automatically after any change.
The LDAP Advanced Setting section contains options that are not needed for a working connection. This provides
controls to disable the current configuration, configure replica hosts, and various performance-enhancing options.
The Advanced Settings are structured into three parts:
• Connection Settings
• Directory Settings
• Special Attributes
Connection settings
Configuration Active: Enables or Disables the current configuration. By default, it is turned off. When Nextcloud
makes a successful test connection it is automatically turned on.
Backup (Replica) Host: If you have a backup LDAP server, enter the connection settings here. Nextcloud will then
automatically connect to the backup when the main server cannot be reached. The backup server must be a
replica of the main server so that the object UUIDs match.
Example:
• directory2.my-company.com
Backup (Replica) Port: The connection port of the backup LDAP server. If no port is given, but only a host, then the
main port (as specified above) will be used.
Example:
• 389
Disable Main Server: You can manually override the main server and make Nextcloud only connect to the backup
server. This is useful for planned downtimes.
Turn off SSL certificate validation: Turns off SSL certificate checking. Use it for testing only!
Cache Time-To-Live: A cache is introduced to avoid unnecessary LDAP traffic, for example caching usernames
so they don’t have to be looked up for every page, and speeding up loading of the Users page. Saving the
configuration empties the cache. The time is given in seconds.
Note that almost every PHP request requires a new connection to the LDAP server. If you require fresh PHP
requests we recommend defining a minimum lifetime of 15s or so, rather than completely eliminating the cache.
Examples:
• ten minutes: 600
• one hour: 3600
See the Caching section below for detailed information on how the cache operates.
Directory settings
User Display Name Field: The attribute that should be used as display name in Nextcloud.
• Example: displayName
2nd User Display Name Field: An optional second attribute displayed in brackets after the display name, for exam-
ple using the mail attribute displays as Molly Foo ([email protected]).
Base User Tree: The base DN of LDAP, from where all users can be reached. This must be a complete DN, regardless
of what you have entered for your Base DN in the Basic setting. You can specify multiple base trees, one on
each line.
• Example:
cn=programmers,dc=my-company,dc=com
cn=designers,dc=my-company,dc=com
User Search Attributes: These attributes are used when searches for users are performed, for example in the share
dialogue. The user display name attribute is the default. You may list multiple attributes, one per line.
If an attribute is not available on a user object, the user will not be listed, and will be unable to login. This also
affects the display name attribute. If you override the default you must specify the display name attribute here.
• Example:
displayName
mail
Group Display Name Field: The attribute that should be used as Nextcloud group name. Nextcloud allows a limited
set of characters (a-zA-Z0-9.-_@). Once a group name is assigned it cannot be changed.
• Example: cn
Base Group Tree: The base DN of LDAP, from where all groups can be reached. This must be a complete DN,
regardless of what you have entered for your Base DN in the Basic setting. You can specify multiple base trees,
one in each line.
• Example:
cn=barcelona,dc=my-company,dc=com
cn=madrid,dc=my-company,dc=com
Group Search Attributes: These attributes are used when a search for groups is done, for example in the share
dialogue. By default the group display name attribute as specified above is used. Multiple attributes can be
given, one in each line.
If you override the default, the group display name attribute will not be taken into account, unless you specify it
as well.
• Example:
cn
description
Group Member association: The attribute that is used to indicate group memberships, i.e. the attribute used by
LDAP groups to refer to their users.
Nextcloud detects the value automatically. You should only change it if you have a very valid reason and know
what you are doing.
• Example: uniquemember
Nested groups: Enable group member retrieval from sub groups.
To allow user listing and login from nested groups, please see User listing and login per nested groups in the
section Troubleshooting, Tips and Tricks.
Enable LDAP password changes per user: Allow LDAP users to change their password and allow Super Adminis-
trators and Group Administrators to change the password of their LDAP users.
To enable this feature, the following requirements have to be met:
• General requirements:
• Access control policies must be configured on the LDAP server to grant permissions for password changes.
The User DN as configured in Server Settings needs to have write permissions in order to update the
userPassword attribute.
• Passwords are sent in plaintext to the LDAP server. Therefore, transport encryption must be used for the
communication between Nextcloud and the LDAP server, e.g. employ LDAPS.
• Enabling password hashing on the LDAP server is highly recommended. While Active Direc-
tory stores passwords in a one-way format by default, OpenLDAP users could configure the
ppolicy_hash_cleartext directive of the ppolicy overlay that ships with OpenLDAP.
• Additional requirements for Active Directory:
• At least a 128-bit transport encryption must be used for the communication between Nextcloud and the
LDAP server.
• Make sure that the fUserPwdSupport char of the dSHeuristics is configured to employ the
userPassword attribute as unicodePwd alias. While this is set accordingly on AD LDS by default,
this is not the case on AD DS.
Default password policy DN: This feature requires OpenLDAP with ppolicy. The DN of a default password policy
will be used for password expiry handling in the absence of any user specific password policy. Password expiry
handling features the following:
• When a LDAP password is about to expire, display a warning message to the user showing the number
of days left before it expires. Password expiry warnings are displayed through the notifications app for
Nextcloud.
• Prompt LDAP users with expired passwords to reset their password during login, provided that an adequate
number of grace logins is still available.
Leave the setting empty to keep password expiry handling disabled.
For the password expiry handling feature to work, LDAP password changes per user must be enabled and the
LDAP server must be running OpenLDAP with its ppolicy module configured accordingly.
• Example:
cn=default,ou=policies,dc=my-company,dc=com
Special attributes
Quota Field: Nextcloud can read an LDAP attribute and set the user quota according to its value. Specify the attribute
here, and it will return human-readable values, e.g. “2 GB”. Any quota set in LDAP overrides quotas set on the
Nextcloud user management page.
• Example: NextcloudQuota
Quota Default: Override Nextcloud default quota for LDAP users who do not have a quota set in the Quota Field.
• Example: 15 GB
Email Field: Set the user’s email from their LDAP attribute. Leave it empty for default behavior.
• Example: mail
User Home Folder Naming Rule: By default, the Nextcloud server creates the user directory in your Nextcloud data
directory and gives it the Nextcloud username, .e.g /var/www/nextcloud/data/alice. You may want
to override this setting and name it after an LDAP attribute value. The attribute can also return an absolute path,
e.g. /mnt/storage43/alice. Leave it empty for default behavior.
• Example: cn
In new Nextcloud installations the home folder rule is enforced. This means that once you set a home folder naming
rule (get a home folder from an LDAP attribute), it must be available for all users. If it isn’t available for a user, then
that user will not be able to login. Also, the filesystem will not be set up for that user, so their file shares will not be
available to other users.
In migrated Nextcloud installations the old behavior still applies, which is using the Nextcloud username as the home
folder when an LDAP attribute is not set. You may change this enforcing the home folder rule with the occ command
in Nextcloud, like this example on Ubuntu:
In the Expert Settings fundamental behavior can be adjusted to your needs. The configuration should be well-tested
before starting production use.
Internal Username: The internal username is the identifier in Nextcloud for LDAP users. By default it will be created
from the UUID attribute. The UUID attribute ensures that the username is unique, and that characters do not
need to be converted. Only these characters are allowed: [a-zA-Z0-9_.@-]. Other characters are replaced with
their ASCII equivalents, or are simply omitted.
The LDAP backend ensures that there are no duplicate internal usernames in Nextcloud, i.e. that it is checking
all other activated user backends (including local Nextcloud users). On collisions a random number (between
1000 and 9999) will be attached to the retrieved value. For example, if “alice” exists, the next username may be
“alice_1337”.
The internal username is the default name for the user home folder in Nextcloud. It is also a part of remote
URLs, for instance for all *DAV services.
You can override all of this with the Internal Username setting. Leave it empty for default behavior. Changes
will affect only newly mapped LDAP users.
• Example: uid
Override UUID detection By default, Nextcloud auto-detects the UUID attribute. The UUID attribute is used to
uniquely identify LDAP users and groups. The internal username will be created based on the UUID, if not
specified otherwise.
You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your
choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes
will have effect only on newly mapped LDAP users and groups. It also will have effect when a user’s or group’s
DN changes and an old UUID was cached, which will result in a new user. Because of this, the setting should
be applied before putting Nextcloud in production use and clearing the bindings (see the User and Group
Mapping section below).
• Example: cn
Username-LDAP User Mapping Nextcloud uses usernames as keys to store and assign data. In order to precisely
identify and recognize users, each LDAP user will have a internal username in Nextcloud. This requires a
mapping from Nextcloud username to LDAP user. The created username is mapped to the UUID of the LDAP
user. Additionally the DN is cached as well to reduce LDAP interaction, but it is not used for identification. If
the DN changes, the change will be detected by Nextcloud by checking the UUID value.
The same is valid for groups.
The internal Nextcloud name is used all over in Nextcloud. Clearing the Mappings will have leftovers every-
where. Never clear the mappings in a production environment, but only in a testing or experimental server.
Warning: Clearing the Mappings is not configuration sensitive, it affects all LDAP configurations!
The Test Configuration button checks the values as currently given in the input fields. You do not need to save before
testing. By clicking on the button, Nextcloud will try to bind to the Nextcloud server using the settings currently given
in the input fields. If the binding fails you’ll see a yellow banner with the error message “The configuration is invalid.
Please have a look at the logs for further details.”
When the configuration test reports success, save your settings and check if the users and groups are fetched correctly
on the Users page.
Few configuration settings can only be set on command line via occ.
The LDAP backend will update user information that is used within Nextcloud with the values provided by the LDAP
server. For instance these are email, quota or the avatar. This happens on every login, the first detection of a user from
LDAP and regularly by a background job.
The interval value determines the time between updates of the values and is used to avoid frequent overhead, including
time-expensive write actions to the database.
The interval is described in seconds and it defaults to 86400 equalling a day. It is not a per-configuration option.
The value can be modified by:
Nextcloud supports user profile pictures, which are also called avatars. If a user has a photo stored in the jpegPhoto or
thumbnailPhoto attribute on your LDAP server, it will be used as their avatar. In this case the user cannot alter their
avatar (on their Personal page) as it must be changed in LDAP. jpegPhoto is preferred over thumbnailPhoto.
If the jpegPhoto or thumbnailPhoto attribute is not set or empty, then users can upload and manage their avatars on
their Nextcloud Personal pages. Avatars managed in Nextcloud are not stored in LDAP.
The jpegPhoto or thumbnailPhoto attribute is fetched once a day to make sure the current photo from LDAP is used
in Nextcloud. LDAP avatars override Nextcloud avatars, and when an LDAP avatar is deleted then the most recent
Nextcloud avatar replaces it.
Photos served from LDAP are automatically cropped and resized in Nextcloud. This affects only the presentation, and
the original image is not changed.
It is possible to turn off the avatar integration or specify a single, different attribute to read the image from. It is
expected to contain image data just like jpegPhoto or thumbnailPhoto do.
The behaviour can be changed using the occ command line tool only. Essentially those options are available:
• The default behaviour as described above should be used
occ ldap:set-config "s01" "ldapUserAvatarRule" "default"
• User images shall not be fetched from LDAP
occ ldap:set-config "s01" "ldapUserAvatarRule" "none"
A common mistake with SSL certificates is that they may not be known to PHP. If you have trouble with certificate
validation make sure that
• You have the certificate of the server installed on the Nextcloud server
• The certificate is announced in the system’s LDAP configuration file (usually /etc/ldap/ldap.conf )
• Using LDAPS, also make sure that the port is correctly configured (by default 636)
Compared to earlier Nextcloud versions, no further tweaks need to be done to make Nextcloud work with Active
Directory. Nextcloud will automatically find the correct configuration in the set-up process.
If you want to use memberOf within your filter you might need to give your querying user the permissions to use it.
For Microsoft Active Directory this is described here.
When it is intended to allow user listing and login based on a specific group having subgroups (“nested groups”),
checking Nested groups on Directory Settings is not enough. Also the User (and Login) filter need to be changed, by
specifying the LDAP_MATCHING_RULE_IN_CHAIN matching rule. Change the filter parts containing the memberof
condition according to this example:
• (memberof=cn=Nextcloud Users Group,ou=Groups,. . . )
to
• (memberof:1.2.840.113556.1.4.1941:=cn=Nextcloud Users Group,ou=Groups,. . . )
In case you have a working configuration and want to create a similar one or “snapshot” configurations before modi-
fying them you can do the following:
1. Go to the Server tab
2. On Server Configuration choose Add Server Configuration
3. Answer the question Take over settings from recent server configuration? with yes.
4. (optional) Switch to Advanced tab and uncheck Configuration Active in the Connection Settings, so the new
configuration is not used on Save
5. Click on Save
Some parts of how the LDAP backend works are described here.
In Nextcloud the user or group name is used to have all relevant information in the database assigned. To work reliably
a permanent internal user name and group name is created and mapped to the LDAP DN and UUID. If the DN changes
in LDAP it will be detected, and there will be no conflicts.
Those mappings are done in the database table ldap_user_mapping and ldap_group_mapping. The user
name is also used for the user’s folder (except if something else is specified in User Home Folder Naming Rule),
which contains files and meta data.
As of Nextcloud 5 the internal user name and a visible display name are separated. This is not the case for group
names, yet, i.e. a group name cannot be altered.
That means that your LDAP configuration should be good and ready before putting it into production. The mapping
tables are filled early, but as long as you are testing, you can empty the tables any time. Do not do this in production.
Caching
The LDAP information is cached in Nextcloud memory cache, and you must install and configure the memory cache
(see Configuring memory caching). The Nextcloud Cache helps to speed up user interactions and sharing. It is
populated on demand, and remains populated until the Cache Time-To-Live for each unique request expires. User
logins are not cached, so if you need to improve login times set up a slave LDAP server to share the load.
You can adjust the Cache Time-To-Live value to balance performance and freshness of LDAP data. All LDAP
requests will be cached for 10 minutes by default, and you can alter this with the Cache Time-To-Live setting. The
cache answers each request that is identical to a previous request, within the time-to-live of the original request, rather
than hitting the LDAP server.
The Cache Time-To-Live is related to each single request. After a cache entry expires there is no automatic trigger
for re-populating the information, as the cache is populated only by new requests, for example by opening the User
administration page, or searching in a sharing dialog.
There is one trigger which is automatically triggered by a certain background job which keeps the
user-group-mappings up-to-date, and always in cache.
Under normal circumstances, all users are never loaded at the same time. Typically the loading of users happens
while page results are generated, in steps of 30 until the limit is reached or no results are left. For this to work on an
oC-Server and LDAP-Server, Paged Results must be supported.
Nextcloud remembers which user belongs to which LDAP-configuration. That means each request will always be
directed to the right server unless a user is defunct, for example due to a server migration or unreachable server. In
this case the other servers will also receive the request.
When Nextcloud is not able to contact the main LDAP server, Nextcloud assumes it is offline and will not try to
connect again for the time specified in Cache Time-To-Live. If you have a backup server configured Nextcloud
will connect to it instead. When you have scheduled downtime, check Disable Main Server to avoid unnecessary
connection attempts.
LDAP User Cleanup is a new feature in the LDAP user and group backend application. LDAP User Cleanup
is a background process that automatically searches the Nextcloud LDAP mappings table, and verifies if the LDAP
users are still available. Any users that are not available are marked as deleted in the oc_preferences database
table. Then you can run a command to display this table, displaying only the users marked as deleted, and then you
have the option of removing their data from your Nextcloud data directory.
These items are removed upon cleanup:
• Local Nextcloud group assignments
• User preferences (DB table oc_preferences)
• User’s Nextcloud home folder
• User’s corresponding entry in oc_storages
There are two prerequisites for LDAP User Cleanup to operate:
1. Set ldapUserCleanupInterval in config.php to your desired check interval in minutes. The default
is 51 minutes.
2. All configured LDAP connections are enabled and operating correctly. As users can exist on multiple LDAP
servers, you want to be sure that all of your LDAP servers are available so that a user on a temporarily discon-
nected LDAP server is not marked as deleted.
The background process examines 50 users at a time, and runs at the interval you configured
with ldapUserCleanupInterval. For example, if you have 200 LDAP users and your
ldapUserCleanupInterval is 20 minutes, the process will examine the first 50 users, then 20 minutes
later the next 50 users, and 20 minutes later the next 50, and so on.
There are two occ commands to use for examining a table of users marked as deleted, and then manually deleting
them. The occ command is in your Nextcloud directory, for example /var/www/nextcloud/occ, and it must
be run as your HTTP user. To learn more about occ, see Using the occ command.
These examples are for Ubuntu Linux:
1. sudo -u www-data php occ ldap:show-remnants displays a table with all users that have been
marked as deleted, and their LDAP data.
2. sudo -u www-data php occ user:delete [user] removes the user’s data from the Nextcloud
data directory.
This example shows what the table of users marked as deleted looks like:
Then you can run sudo -u www-data php occ user:delete aaliyah_brown to delete user
aaliyah_brown. You must use the user’s Nextcloud name.
You may also use occ user:delete [user] to remove a local Nextcloud user; this removes their user account
and their data.
All methods require that the “OCS-APIREQUEST” header be set to “true”. Methods take an optional “format”
parameter, which may be “xml” (the default) or “json”.
Creates a new and empty LDAP configuration. It returns its ID. Authentication is done by sending a basic HTTP
authentication header.
Syntax: ocs/v2.php/apps/user_ldap/api/v1/config
• HTTP method: POST
Example
• POST https://admin:[email protected]/ocs/v2.php/apps/user_ldap/api/v1/
config -H “OCS-APIREQUEST: true”
• Creates a new, empty configuration
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>200</statuscode>
<message>OK</message>
</meta>
<data>
<configID>s01</configID>
</data>
</ocs>
Deletes a given LDAP configuration. Authentication is done by sending a basic HTTP authentication header.
Syntax: ocs/v2.php/apps/user_ldap/api/v1/config/{configID}
• HTTP method: DELETE
Example
• DELETE https://admin:[email protected]/ocs/v2.php/apps/user_ldap/api/v1/
config/s02 -H "OCS-APIREQUEST: true"
• deletes the LDAP configuration
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>200</statuscode>
<message>OK</message>
</meta>
<data/>
</ocs>
Returns all keys and values of the specified LDAP configuration. Authentication is done by sending a basic HTTP
authentication header.
Syntax: ocs/v2.php/apps/user_ldap/api/v1/config/{configID}
• HTTP method: GET
• url argument: showPassword - int, optional, default 0, whether to return the password in clear text
Example
• GET https://admin:[email protected]/ocs/v2.php/apps/user_ldap/api/v1/
config/s02?showPassword=1 -H "OCS-APIREQUEST: true"
• fetches the LDAP configuration
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>200</statuscode>
<message>OK</message>
</meta>
<data>
<ldapHost>ldap://ldap.server.tld</ldapHost>
<ldapPort>389</ldapPort>
<ldapBackupHost></ldapBackupHost>
<ldapBackupPort></ldapBackupPort>
<ldapBase>ou=Department XLII,dc=example,dc=com</ldapBase>
<ldapBaseUsers>ou=users,ou=Department XLII,dc=example,dc=com</ldapBaseUsers>
<ldapBaseGroups>ou=Department XLII,dc=example,dc=com</ldapBaseGroups>
<ldapAgentName>cn=root,dc=example,dc=com</ldapAgentName>
<ldapAgentPassword>Secret</ldapAgentPassword>
<ldapTLS>1</ldapTLS>
<turnOffCertCheck>0</turnOffCertCheck>
<ldapIgnoreNamingRules/>
<ldapUserDisplayName>displayname</ldapUserDisplayName>
<ldapUserDisplayName2>uid</ldapUserDisplayName2>
<ldapGidNumber>gidNumber</ldapGidNumber>
<ldapUserFilterObjectclass>inetOrgPerson</ldapUserFilterObjectclass>
<ldapUserFilterGroups></ldapUserFilterGroups>
<ldapUserFilter>(&(objectclass=nextcloudUser)(nextcloudEnabled=TRUE))</
˓→ldapUserFilter>
<ldapUserFilterMode>1</ldapUserFilterMode>
<ldapGroupFilter>(&(|(objectclass=nextcloudGroup)))</ldapGroupFilter>
<ldapGroupFilterMode>0</ldapGroupFilterMode>
<ldapGroupFilterObjectclass>nextcloudGroup</ldapGroupFilterObjectclass>
<ldapGroupFilterGroups></ldapGroupFilterGroups>
<ldapGroupMemberAssocAttr>memberUid</ldapGroupMemberAssocAttr>
<ldapGroupDisplayName>cn</ldapGroupDisplayName>
<ldapLoginFilter>(&(|(objectclass=inetOrgPerson))(uid=%uid))</ldapLoginFilter>
<ldapLoginFilterMode>0</ldapLoginFilterMode>
<ldapLoginFilterEmail>0</ldapLoginFilterEmail>
<ldapLoginFilterUsername>1</ldapLoginFilterUsername>
<ldapLoginFilterAttributes></ldapLoginFilterAttributes>
<ldapQuotaAttribute></ldapQuotaAttribute>
<ldapQuotaDefault>20 MB</ldapQuotaDefault>
<ldapEmailAttribute>mail</ldapEmailAttribute>
<ldapCacheTTL>600</ldapCacheTTL>
<ldapUuidUserAttribute>auto</ldapUuidUserAttribute>
<ldapUuidGroupAttribute>auto</ldapUuidGroupAttribute>
<ldapOverrideMainServer></ldapOverrideMainServer>
<ldapConfigurationActive>1</ldapConfigurationActive>
<ldapAttributesForUserSearch>uid;sn;givenname</ldapAttributesForUserSearch>
<ldapAttributesForGroupSearch></ldapAttributesForGroupSearch>
<ldapExperiencedAdmin>0</ldapExperiencedAdmin>
<homeFolderNamingRule>attr:mail</homeFolderNamingRule>
<hasPagedResultSupport></hasPagedResultSupport>
<hasMemberOfFilterSupport>1</hasMemberOfFilterSupport>
<useMemberOfToDetectMembership>1</useMemberOfToDetectMembership>
<ldapExpertUsernameAttr></ldapExpertUsernameAttr>
<ldapExpertUUIDUserAttr></ldapExpertUUIDUserAttr>
<ldapExpertUUIDGroupAttr></ldapExpertUUIDGroupAttr>
<lastJpegPhotoLookup>0</lastJpegPhotoLookup>
<ldapNestedGroups>0</ldapNestedGroups>
<ldapPagingSize>500</ldapPagingSize>
<turnOnPasswordChange>1</turnOnPasswordChange>
<ldapDynamicGroupMemberURL></ldapDynamicGroupMemberURL>
<ldapDefaultPPolicyDN></ldapDefaultPPolicyDN>
</data>
</ocs>
Updates a configuration with the provided values. Authentication is done by sending a basic HTTP authentication
header.
Syntax: ocs/v2.php/apps/user_ldap/api/v1/config/{configID}
• HTTP method: PUT
• url argument: configData - array, see table below for the fields. All fields are optional. The values must be
url-encoded.
Example
• PUT https://admin:[email protected]/ocs/v2.php/apps/
user_ldap/api/v1/config/s01 -H "OCS-APIREQUEST: true"
-d "configData[ldapHost]=ldap%3A%2F%2Fldap.server.tld
&configData[ldapPort]=389"
• fetches the LDAP configuration
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>200</statuscode>
<message>OK</message>
</meta>
<data/>
</ocs>
The Provisioning API application enables a set of APIs that external systems can use to create, edit, delete and query
user attributes, query, set and remove groups, set quota and query total storage used in Nextcloud. Group admin users
can also query Nextcloud and perform the same functions as an admin for groups they manage. The API also enables
an admin to query for active Nextcloud applications, application info, and to enable or disable an app remotely. HTTP
requests can be used via a Basic Auth header to perform any of the functions listed above. The Provisioning API app
is enabled by default.
The base URL for all calls to the share API is nextcloud_base_url/ocs/v1.php/cloud.
All calls to OCS endpoints require the OCS-APIRequest header to be set to true.
All POST requests require the Content-Type: application/x-www-form-urlencoded header. (Note:
Some libraries like cURL set this header automatically, others require setting the header explicitly.)
Create a new user on the Nextcloud server. Authentication is done by sending a basic HTTP authentication header.
Syntax: ocs/v1.php/cloud/users
• HTTP method: POST
• POST argument: userid - string, the required username for the new user
• POST argument: password - string, the required password for the new user
Status codes:
• 100 - successful
• 101 - invalid input data
• 102 - username already exists
• 103 - unknown error occurred whilst adding the user
• 104 - group does not exist
• 105 - insufficient privileges for group
• 106 - no group specified (required for subadmins)
• 107 - all errors that contain a hint - for example “Password is among the 1,000,000 most common ones. Please
make it unique.” (this code was added in 12.0.6 & 13.0.1)
Example
• POST http://admin:[email protected]/ocs/v1.php/cloud/users -d
userid="Frank" -d password="frankspassword"
• Creates the user Frank with password frankspassword
• optionally groups can be specified by one or more groups[] query parameters: URL -d
groups[]="admin" -D groups[]="Team1"
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data/>
</ocs>
Search/get users
Retrieves a list of users from the Nextcloud server. Authentication is done by sending a Basic HTTP Authorization
header.
Syntax: ocs/v1.php/cloud/users
• HTTP method: GET
• url arguments: search - string, optional search string
• url arguments: limit - int, optional limit value
• url arguments: offset - int, optional offset value
Status codes:
• 100 - successful
Example
• GET http://admin:[email protected]/ocs/v1.php/cloud/users?search=Frank
• Returns list of users matching the search string.
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<users>
<element>Frank</element>
</users>
</data>
</ocs>
Retrieves information about a single user. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}
• HTTP method: GET
Status codes:
• 100 - successful
Example
• GET http://admin:[email protected]/ocs/v1.php/cloud/users/Frank
• Returns information on the user Frank
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<enabled>true</enabled>
<id>Frank</id>
<quota>0</quota>
<email>[email protected]</email>
<displayname>Frank K.</displayname>
<phone>0123 / 456 789</phone>
<address>Foobar 12, 12345 Town</address>
<website>https://nextcloud.com</website>
<twitter>Nextcloud</twitter>
<groups>
<element>group1</element>
<element>group2</element>
</groups>
</data>
</ocs>
Edits attributes related to a user. Users are able to edit email, displayname and password; admins can also edit the
quota value. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}
• HTTP method: PUT
• PUT argument: key, the field to edit:
– email
– quota
– displayname
– display (deprecated use displayname instead)
– phone
– address
– website
– twitter
– password
• PUT argument: value, the new value for the field
Status codes:
• 100 - successful
• 101 - user not found
• 102 - invalid input data
Examples
• PUT http://admin:[email protected]/ocs/v1.php/cloud/users/Frank -d
key="email" -d value="[email protected]"
• Updates the email address for the user Frank
• PUT http://admin:[email protected]/ocs/v1.php/cloud/users/Frank -d
key="quota" -d value="100MB"
• Updates the quota for the user Frank
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Disable a user
Disables a user on the Nextcloud server so that the user cannot login anymore. Authentication is done by sending a
Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}/disable
• HTTP method: PUT
Statuscodes:
• 100 - successful
• 101 - failure
Example
• PUT http://admin:[email protected]/ocs/v1.php/cloud/users/Frank/disable
• Disables the user Frank
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data/>
</ocs>
Enable a user
Enables a user on the Nextcloud server so that the user can login again. Authentication is done by sending a Basic
HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}/enable
• HTTP method: PUT
Statuscodes:
• 100 - successful
• 101 - failure
Example
• PUT http://admin:[email protected]/ocs/v1.php/cloud/users/Frank/enable
• Enables the user Frank
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data/>
</ocs>
Delete a user
Deletes a user from the Nextcloud server. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}
• HTTP method: DELETE
Statuscodes:
• 100 - successful
• 101 - failure
Example
• DELETE http://admin:[email protected]/ocs/v1.php/cloud/users/Frank
• Deletes the user Frank
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Retrieves a list of groups the specified user is a member of. Authentication is done by sending a Basic HTTP Autho-
rization header.
Syntax: ocs/v1.php/cloud/users/{userid}/groups
• HTTP method: GET
Status codes:
• 100 - successful
Example
• GET http://admin:[email protected]/ocs/v1.php/cloud/users/Frank/groups
• Retrieves a list of groups of which Frank is a member
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<groups>
<element>admin</element>
<element>group1</element>
</groups>
</data>
</ocs>
Adds the specified user to the specified group. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}/groups
• HTTP method: POST
• POST argument: groupid, string - the group to add the user to
Status codes:
• 100 - successful
• 101 - no group specified
• 102 - group does not exist
• 103 - user does not exist
• 104 - insufficient privileges
• 105 - failed to add user to group
Example
• POST http://admin:[email protected]/ocs/v1.php/cloud/users/Frank/groups
-d groupid="newgroup"
• Adds the user Frank to the group newgroup
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Removes the specified user from the specified group. Authentication is done by sending a Basic HTTP Authorization
header.
Syntax: ocs/v1.php/cloud/users/{userid}/groups
• HTTP method: DELETE
• DELETE argument: groupid, string - the group to remove the user from
Status codes:
• 100 - successful
• 101 - no group specified
• 102 - group does not exist
• 103 - user does not exist
• 104 - insufficient privileges
• 105 - failed to remove user from group
Example
• DELETE http://admin:[email protected]/ocs/v1.php/cloud/users/Frank/groups
-d groupid="newgroup"
• Removes the user Frank from the group newgroup
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Makes a user the subadmin of a group. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}/subadmins
• HTTP method: POST
• POST argument: groupid, string - the group of which to make the user a subadmin
Status codes:
• 100 - successful
• 101 - user does not exist
• 102 - group does not exist
• 103 - unknown failure
Example
• POST https://admin:[email protected]/ocs/v1.php/cloud/users/Frank/
subadmins -d groupid="group"
• Makes the user Frank a subadmin of the group group
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Removes the subadmin rights for the user specified from the group specified. Authentication is done by sending a
Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/users/{userid}/subadmins
• HTTP method: DELETE
• DELETE argument: groupid, string - the group from which to remove the user’s subadmin rights
Status codes:
• 100 - successful
• 101 - user does not exist
• 102 - user is not a subadmin of the group / group does not exist
• 103 - unknown failure
Example
• DELETE https://admin:[email protected]/ocs/v1.php/cloud/users/Frank/
subadmins -d groupid="oldgroup"
• Removes Frank's subadmin rights from the oldgroup group
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Returns the groups in which the user is a subadmin. Authentication is done by sending a Basic HTTP Authorization
header.
Syntax: ocs/v1.php/cloud/users/{userid}/subadmins
• HTTP method: GET
Status codes:
• 100 - successful
• 101 - user does not exist
• 102 - unknown failure
Example
• GET https://admin:[email protected]/ocs/v1.php/cloud/users/Frank/
subadmins
• Returns the groups of which Frank is a subadmin
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data>
<element>testgroup</element>
</data>
</ocs>
The request to this endpoint triggers the welcome email for this user again.
Syntax: ocs/v1.php/cloud/users/{userid}/welcome
• HTTP method: POST
Status codes:
• 100 - successful
• 101 - email address not available
• 102 - sending email failed
Example
• POST https://admin:[email protected]/ocs/v1.php/cloud/users/Frank/welcome
• Sends the welcome email to Frank
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data/>
</ocs>
Search/get groups
Retrieves a list of groups from the Nextcloud server. Authentication is done by sending a Basic HTTP Authorization
header.
Syntax: ocs/v1.php/cloud/groups
• HTTP method: GET
• url arguments: search - string, optional search string
• url arguments: limit - int, optional limit value
• url arguments: offset - int, optional offset value
Status codes:
• 100 - successful
Example
• GET http://admin:[email protected]/ocs/v1.php/cloud/groups?search=adm
• Returns list of groups matching the search string.
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<groups>
<element>admin</element>
</groups>
</data>
</ocs>
Create a group
Adds a new group. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/groups
• HTTP method: POST
• POST argument: groupid, string - the new groups name
Status codes:
• 100 - successful
• 101 - invalid input data
• 102 - group already exists
• 103 - failed to add the group
Example
• POST http://admin:[email protected]/ocs/v1.php/cloud/groups -d
groupid="newgroup"
• Adds a new group called newgroup
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Retrieves a list of group members. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/groups/{groupid}
• HTTP method: GET
Status codes:
• 100 - successful
Example
• POST http://admin:[email protected]/ocs/v1.php/cloud/groups/admin
• Returns a list of users in the admin group
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<users>
<element>Frank</element>
</users>
</data>
</ocs>
Returns subadmins of the group. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/groups/{groupid}/subadmins
• HTTP method: GET
Status codes:
• 100 - successful
• 101 - group does not exist
• 102 - unknown failure
Example
• GET https://admin:[email protected]/ocs/v1.php/cloud/groups/mygroup/
subadmins
• Return the subadmins of the group: mygroup
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<status>ok</status>
<statuscode>100</statuscode>
<message/>
</meta>
<data>
<element>Tom</element>
</data>
</ocs>
Delete a group
Example
• DELETE http://admin:[email protected]/ocs/v1.php/cloud/groups/mygroup
• Delete the group mygroup
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data/>
</ocs>
Getlist of apps
Returns a list of apps installed on the Nextcloud server. Authentication is done by sending a Basic HTTP Authorization
header.
Syntax: ocs/v1.php/cloud/apps/
• HTTP method: GET
• url argument: filter, string - optional (enabled or disabled)
Status codes:
• 100 - successful
• 101 - invalid input data
Example
• GET http://admin:[email protected]/ocs/v1.php/cloud/apps?filter=enabled
• Gets enabled apps
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<apps>
<element>files</element>
<element>provisioning_api</element>
</apps>
</data>
</ocs>
Provides information on a specific application. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/apps/{appid}
• HTTP method: GET
Status codes:
• 100 - successful
Example
• GET http://admin:[email protected]/ocs/v1.php/cloud/apps/files
• Get app info for the files app
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
<data>
<info/>
<remote>
<files>appinfo/remote.php</files>
<webdav>appinfo/remote.php</webdav>
<filesync>appinfo/filesync.php</filesync>
</remote>
<public/>
<id>files</id>
<name>Files</name>
<description>File Management</description>
<licence>AGPL</licence>
<author>Robin Appelman</author>
<require>4.9</require>
<shipped>true</shipped>
<standalone></standalone>
<default_enable></default_enable>
<types>
<element>filesystem</element>
</types>
</data>
</ocs>
Enable an app
Example
• POST http://admin:[email protected]/ocs/v1.php/cloud/apps/
files_texteditor
• Enable the files_texteditor app
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
</ocs>
Disable an app
Disables the specified app. Authentication is done by sending a Basic HTTP Authorization header.
Syntax: ocs/v1.php/cloud/apps/{appid}
• HTTP method: DELETE
Status codes:
• 100 - successful
Example
• DELETE http://admin:[email protected]/ocs/v1.php/cloud/apps/
files_texteditor
• Disable the files_texteditor app
XML output
<?xml version="1.0"?>
<ocs>
<meta>
<statuscode>100</statuscode>
<status>ok</status>
</meta>
</ocs>
SIX
Nextcloud users can share files with their Nextcloud groups and other users on the same Nextcloud server, with
Nextcloud users on other Nextcloud servers, and create public shares for people who are not Nextcloud users. You
have control of a number of user permissions on file shares:
• Allow users to share files
• Allow users to create public shares
• Require a password on public shares
• Allow public uploads to public shares
• Require an expiration date on public share links
• Allow resharing
• Restrict sharing to group members only
• Allow email notifications of new public shares
• Exclude groups from creating shares
Configure your sharing policy on your Admin page in the Sharing section.
169
Nextcloud Server Administration Manual, Release 14
• Check Allow apps to use the Share API to enable users to share files. If this is not checked, no
users can create file shares.
• Check Allow users to share via link to enable creating public shares for people who are not
Nextcloud users via hyperlink.
• Check Enforce password protection to force users to set a password on all public share links. This
does not apply to local user and group shares.
• Check Allow public uploads to allow anyone to upload files to public shares.
• Check Allow users to send mail notification for shared files to enable sending noti-
fications from Nextcloud. (Your Nextcloud server must be configured to send mail)
• Check Set default expiration date to set a default expiration date on public shares.
• Check Allow resharing to enable users to re-share files shared with them.
• Check Restrict users to only share with users in their groups to confine sharing
within group memberships.
Note: This setting does not apply to the Federated Cloud sharing feature. If Federated Cloud
Sharing is enabled, users can still share items with any users on any instances (including the one they
are on) via a remote share.
• Check Allow users to send mail notification for shared files enables users to send
an email notification to every Nextcloud user that the file is shared with.
• Check Exclude groups from sharing to prevent members of specific groups from creating any file
shares in those groups. When you check this, you’ll get a dropdown list of all your groups to choose from.
Members of excluded groups can still receive shares, but not create any
Note: Nextcloud does not preserve the mtime (modification time) of directories, though it does update the mtimes on
files. See Wrong folder date when syncing for discussion of this.
You may transfer files from one user to another with occ. This is useful when you have to remove a user. Be sure to
transfer the files before you delete the user! This transfers all files from user1 to user2, and the shares and metadata
info associated with those files (shares, tags, comments, etc). Trashbin contents are not transferred:
When a user is deleted, their files are also deleted. As you can imagine, this is a problem if they created file shares that
need to be preserved, because these disappear as well. In Nextcloud files are tied to their owners, so whatever happens
to the file owner also happens to the files.
One solution is to create persistent shares for your users. You can retain ownership of them, or you could create a
special user for the purpose of establishing permanent file shares. Simply create a shared folder in the usual way,
and share it with the users or groups who need to use it. Set the appropriate permissions on it, and then no matter
which users come and go, the file shares will remain. Because all files added to the share, or edited in it, automatically
become owned by the owner of the share regardless of who adds or edits them.
Federated Cloud Sharing is now managed by the Federation app (9.0+), and is now called Federation sharing. When
you enable the Federation app you can easily and securely link file shares between Nextcloud servers, in effect creating
a cloud of Nextclouds.
Follow these steps to create a new Federation share between two Nextcloud servers. This requires no action by the
user on the remote server; all it takes is a few steps on the originating server.
1. Enable the Federation app.
2. Go to your Nextcloud Admin page and scroll to the Sharing section. Verify that Allow users on this server to
send shares to other servers and Allow users on this server to receive shares from other servers are enabled.
3. Now go to the Federation section. By default, Add server automatically once a federated share was created
successfully is checked. The Federation app supports creating a list of trusted Nextcloud servers, which allows
the trusted servers to exchange user directories and auto-complete the names of external users when you create
shares. If you do not want this enabled, then un-check it.
4. Now go to your Files page and select a folder to share. Click the share icon, and then enter the username and
URL of the user on the remote Nextcloud server. In this example, that is freda@https://example.com/
nextcloud. When Nextcloud verifies the link, it displays it with the (remote) label. Click on this label to
establish the link.
5. When the link is successfully completed, you have a single share option, and that is can edit.
You may disconnect the share at any time by clicking the trash can icon.
You may create a list of trusted Nextcloud servers for Federation sharing. This allows your linked Nextcloud servers
to share user directories, and to auto-fill user names in share dialogs. If Add server automatically once a federated
share was created successfully is enabled on your Admin page, servers will be automatically added to your trusted
list when you create new Federation shares.
You may also enter Nextcloud server URLs in the Add Nextcloud Server field. The yellow light indicates a success-
ful connection, with no user names exchanged. The green light indicates a successful connection with user names
exchanged. A red light means the connection failed.
Check the Share Link checkbox to expose more sharing options (which are described more fully in File Sharing).
You may create a Federation share by allowing Nextcloud to create a public link for you, and then email it to the
person you want to create the share with.
You may optionally set a password and expiration date on it. When your recipient receives your email they must click
the link, or copy it to a Web browser. They will see a page displaying a thumbnail of the file, with a button to Add to
your Nextcloud.
Your recipient should click the Add to your Nextcloud button. On the next screen your recipient needs to enter the
URL to their Nextcloud server, and then press the return key.
Your recipient has to take one more step, and that is to confirm creating the federated cloud share link by clicking the
Add remote share button.
Un-check the Share Link checkbox to disable any federated cloud share created this way.
The Sharing section on your Admin page allows you to control how your users manage federated cloud shares:
The default maximum file size for uploads is 512MB. You can increase this limit up to what your filesystem and
operating system allows. There are certain hard limits that cannot be exceeded:
• < 2GB on 32Bit OS-architecture
• < 2GB with IE6 - IE8
• < 4GB with IE9 - IE11
64-bit filesystems have much higher limits; consult the documentation for your filesystem.
Note: The Nextcloud sync client is not affected by these upload limits as it is uploading files in smaller chunks.
Note: Nextcloud comes with its own nextcloud/.htaccess file. Because php-fpm can’t read PHP settings
in .htaccess these settings must be set in the nextcloud/.user.ini file.
Set the following two parameters inside the corresponding php.ini file (see the Loaded Configuration File section of
PHP version and information to find your relevant php.ini files)
Adjust these values for your needs. If you see PHP timeouts in your logfiles, increase the timeout values, which are in
seconds:
The mod_reqtimeout Apache module could also stop large uploads from completing. If you’re using this mod-
ule and getting failed uploads of large files either disable it in your Apache config or raise the configured
RequestReadTimeout timeouts.
There are also several other configuration options in your Web server config which could prevent the upload of larger
files. Please see the manual of your Web server for how to configure those values correctly:
Apache
• LimitRequestBody
• SSLRenegBufferSize
• FcgidMaxRequestInMem
• FcgidMaxRequestLen
Note: If you are using Apache/2.4 with mod_fcgid, as of February/March 2016, FcgidMaxRequestInMem still
needs to be significantly increased from its default value to avoid the occurrence of segmentation faults when uploading
big files. This is not a regular setting but serves as a workaround for Apache with mod_fcgid bug #51747.
Setting FcgidMaxRequestInMem significantly higher than normal may no longer be necessary, once bug #51747
is fixed.
nginx
• client_max_body_size
• fastcgi_read_timeout
• client_body_temp_path
Since nginx 1.7.11 a new config option fastcgi_request_buffering is availabe. Setting this option to
fastcgi_request_buffering off; in your nginx config might help with timeouts during the upload. Fur-
thermore it helps if you’re running out of disc space on the tmp partition of your system.
For more info how to configure nginx to raise the upload limits see also this wiki entry.
Note: Make sure that client_body_temp_path points to a partition with adequate space for your upload file
size, and on the same partition as the upload_tmp_dir or tempdirectory (see below). For optimal perfor-
mance, place these on a separate hard drive that is dedicated to swap and temp storage.
• If you can access the frontend’s configuration, disable proxy_buffering or increase proxy_max_temp_file_size
from the default 1GB.
• If you do not have access to the frontend, set the X-Accel-Buffering header to add_header
X-Accel-Buffering no; on your backend server.
If you don’t want to use the Nextcloud .htaccess or .user.ini file, you may configure PHP instead. Make sure
to comment out any lines .htaccess pertaining to upload size, if you entered any.
If you are running Nextcloud on a 32-bit system, any open_basedir directive in your php.ini file needs to be
commented out.
Set the following two parameters inside php.ini, using your own desired file size values:
upload_max_filesize = 16G
post_max_size = 16G
upload_tmp_dir = /var/big_temp_file/
Output Buffering must be turned off in .htaccess or .user.ini or php.ini, or PHP will return memory-
related errors:
• output_buffering = 0
As an alternative to the upload_tmp_dir of PHP (e.g. if you don’t have access to your php.ini) you can also
configure a temporary location for uploaded files by using the tempdirectory setting in your config.php (See
Configuration Parameters).
If you have configured the session_lifetime setting in your config.php (See Configuration Parameters) file
then make sure it is not too low. This setting needs to be configured to at least the time (in seconds) that the longest
upload will take. If unsure remove this completely from your configuration to reset it to the default shown in the
config.sample.php.
If all prerequisites described in this documentation are in place an admin can change the upload limits on demand by
using the File handling input box within the administrative backend of Nextcloud.
Depending on your environment you might get an insufficient permissions message shown for this input box.
To be able to use this input box you need to make sure that:
• your Web server is able to use the .htaccess file shipped by Nextcloud (Apache only)
• the user your Web server is running as has write permissions to the files .htaccess and .user.ini
You may distribute a set of default files and folders to all users by placing them in directory that is readable by
the webserver user. This allows you to overwrite the files that are shipped by default with Nextcloud in core/
skeleton. That custom directory should then be configured in the config.php via the configuration option
skeletondirectory (see Configuration Parameters). Leave empty to not copy any skeleton files.
These files will be copied only to new users after their initial login, and existing users will not see files that are added
to this directory after their first login. The files in the skeleton directory are copied into the users data directories,
so they may change and delete the files without affecting the originals.
This screenshot shows a set of photos in the skeleton directory.
They appear on the user’s Nextcloud Files page just like any other files.
Note: Overwriting the files in core/skeleton is not recommended, because those changes will be overwritten on
the next update of the Nextcloud server.
The External Storage Support application enables you to mount external storage services and devices as secondary
Nextcloud storage devices. You may also allow users to mount their own external storage services.
Nextcloud 9.0 introduces a new set of occ commands for managing external storage.
Also new in 9.0 is an option for the Nextcloud admin to enable or disable sharing on individual external mountpoints
(see Mount options). Sharing on such mountpoints is disabled by default.
Warning: Enabling this app will disable the Stay logged in checkbox on the login page.
To create a new external storage mount, select an available backend from the dropdown Add storage. Each backend
has different required options, which are configured in the configuration fields.
Each backend may also accept multiple authentication methods. These are selected with the dropdown under Authen-
tication. Different backends support different authentication mechanisms; some specific to the backend, others are
more generic. See External Storage authentication mechanisms for more detailed information.
When you select an authentication mechanism, the configuration fields change as appropriate for the mechanism. The
SFTP backend, for one example, supports username and password, Log-in credentials, save in session, and RSA
public key.
Required fields are marked with a red border. When all required fields are filled, the storage is automatically saved. A
green dot next to the storage row indicates the storage is ready for use. A red or yellow icon indicates that Nextcloud
could not connect to the external storage, so you need to re-check your configuration and network availability.
If there is an error on the storage, it will be marked as unavailable for ten minutes. To re-check it, click the colored
icon or reload your Admin page.
A storage configured in a user’s Personal settings is available only to the user that created it. A storage configured
in the Admin settings is available to all users by default, and it can be restricted to specific users and groups in the
Available for field.
Hover your cursor to the right of any storage configuration to expose the settings button and trashcan. Click the
trashcan to delete the mountpoint. The settings button allows you to configure each storage mount individually with
the following options:
• Encryption
• Previews
• Enable Sharing
• Filesystem check frequency (Never, Once per direct access)
The Encryption checkbox is visible only when the Encryption app is enabled.
Enable Sharing allows the Nextcloud admin to enable or disable sharing on individual mountpoints. When sharing is
disabled the shares are retained internally, so that you can re-enable sharing and the previous shares become available
again. Sharing is disabled by default.
When using self-signed certificates for external storage mounts the certificate must be imported into the personal
settings of the user. Please refer to Nextcloud HTTPS External Mount for more information.
The following backends are provided by the external storages app. Other apps may provide their own backends,
which are not listed here. Google Drive and Dropbox were moved to external apps which are still in development
(Github-Repos for Google Drive and Dropbox).
Amazon S3
Optionally, you can override the hostname, port and region of your S3 server, which is required for non-Amazon
servers such as Ceph Object Gateway.
Enable path style is usually not required (and is, in fact, incompatible with newer Amazon datacenters), but can
be used with non-Amazon servers where the DNS infrastructure cannot be controlled. Ordinarily, requests will be
made with http://bucket.hostname.domain/, but with path style enabled, requests are made with http:/
/hostname.domain/bucket instead.
Legacy authentication is only required for S3 servers that only implement version 2 authentication, by default version
4 authentication will be used.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
FTP/FTPS
Note: The external storage FTP/FTPS needs the allow_url_fopen PHP setting to be set to 1. When having
connection problems make sure that it is not set to 0 in your php.ini. See PHP version and information to learn
how to find the right php.ini file to edit.
See Configuring External Storage (GUI) for additional mount options and information.
FTP uses the password authentication scheme; see External Storage authentication mechanisms for more information
on authentication schemes.
Local
Local storages provide access to any directory on the Nextcloud server. Since this is a significant security risk, Local
storage can only be configured in the Nextcloud admin settings. Non-admin users cannot create Local storage mounts.
Use this to mount any directory on your Nextcloud server that is outside of your Nextcloud data/ directory. This
directory must be readable and writable by your HTTP server user. These ownership and permission examples are on
Ubuntu Linux:
Important: If you use consecutive commands, make sure, you are user www-data:
In the Folder name field enter the folder name that you want to appear on your Nextcloud Files page.
In the Configuration field enter the full filepath of the directory you want to mount.
In the Available for field enter the users or groups who have permission to access the mount. By default all users have
access.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
Nextcloud
A Nextcloud storage is a specialized WebDAV storage, with optimizations for Nextcloud-Nextcloud communication.
See the WebDAV documentation to learn how to configure an Nextcloud external storage.
When filling in the URL field, use the path to the root of the Nextcloud installation, rather than the path to the
WebDAV endpoint. So, for a server at https://example.com/nextcloud, use https://example.com/
nextcloud and not https://example.com/nextcloud/remote.php/dav.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
OpenStack Object Storage is used to connect to an OpenStack Swift server, or to Rackspace. Two authentication
mechanisms are available: one is the generic OpenStack mechanism, and the other is used exclusively for Rackspace,
a provider of object storage that uses the OpenStack Swift protocol.
The OpenStack authentication mechanism uses the OpenStack Keystone v2 protocol. Your Nextcloud configuration
needs:
• Bucket. This is user-defined; think of it as a subdirectory of your total storage. The bucket will be created if it
does not exist.
It may be necessary to specify a Region. Your region should be named in your account information, and you can read
about Rackspace regions at About Regions.
The timeout of HTTP requests is set in the Request timeout field, in seconds.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
SFTP
Nextcloud’s SFTP (FTP over an SSH tunnel) backend supports both password and public key authentication.
The Host field is required; a port can be specified as part of the Host field in the following format: hostname.
domain:port. The default port is 22 (SSH).
For public key authentication, you can generate a public/private key pair from your SFTP with secret key login
configuration.
After generating your keys, you need to copy your new public key to the destination server to .ssh/
authorized_keys. Nextcloud will then use its private key to authenticate to the SFTP server.
The default Remote Subfolder is the root directory (/) of the remote SFTP server, and you may enter any directory
you wish.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
SMB/CIFS
Nextcloud can connect to Windows file servers or other SMB-compatible servers with the SMB/CIFS backend.
Note: The SMB/CIFS backend requires smbclient or the PHP smbclient module to be installed on the Nextcloud
server. The PHP smbclient module is preferred, but either will work. These should be included in any Linux distribu-
tion. (See PECL smbclient if your distro does not include them.)
Note: For improved reliability and performance, we recommended installing libsmbclient-php, a native PHP
module for connecting to SMB servers.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
Starting with Nextcloud 10, Nextcloud can use smb update notifications to listen for changes made to a configured
SMB/CIFS storage and detect external changes made to the storage in near real-time.
Note: Due to limitations of linux based SMB servers, this feature only works reliably on Windows SMB servers.
Note: Using update notifications requires smbclient 4.x or newer. Due to limitations with the smbclient PHP
module, the smbclient binary is required even when using the PHP module.
To start listening to update notifications, start the occ command like this:
You can find the mount id for a specific storage using occ files_external:list
On default this command shows no output, can you see the list of detected changes by passing the -v option to the
command.
SMB authentication
Update notifications are not supported when using ‘Login credentials, save in session’ authentication. Using login
credentials is only supported with ‘Login credentials, save in database’.
Even when using ‘Login credentials, save in database’ or ‘User entered, stored in database’ authentication the notify
process can not use the credentials saved to attach to the smb shares because the notify process does not run in the
context of a specific user in those cases you can provide the username and password using the --username and
--password arguments.
Any updates detected by the notify command will only be synced to the client after the Nextcloud cron job has been
executed (usually every 15 minutes). If this interval is to high for your use case, you can decrease it by running occ
files:scan --unscanned --all at the desired interval. Note that this might increase the server load and
you’ll need to ensure that there is no overlap between runs.
WebDAV
Use this backend to mount a directory from any WebDAV server, or another Nextcloud server.
You need the following information:
• Folder name: The name of your local mountpoint.
• The URL of the WebDAV or Nextcloud server.
• Username and password for the remote server
• Secure https://: We always recommend https:// for security, though you can leave this unchecked for http://.
Optionally, a Remote Subfolder can be specified to change the destination directory. The default is to use the
whole root.
Note: CPanel users should install Web Disk to enable WebDAV functionality.
See Configuring External Storage (GUI) for additional mount options and information.
See External Storage authentication mechanisms for more information on authentication schemes.
Note: A non-blocking or correctly configured SELinux setup is needed for these backends to work. Please refer to
the SELinux configuration.
Check Enable User External Storage to allow your users to mount their own external storage services, and check the
backends you want to allow. Beware, as this allows a user to make potentially arbitrary connections to other services
on your network!
We recommend configuring the background job Webcron or Cron (see Defining background jobs) to enable Nextcloud
to automatically detect files added to your external storages.
Nextcloud may not always be able to find out what has been changed remotely (files changed without going through
Nextcloud), especially when it’s very deep in the folder hierarchy of the external storage.
You might need to setup a cron job that runs sudo -u www-data php occ files:scan --all (or replace
“–all” with the user name, see also Using the occ command) to trigger a rescan of the user’s files periodically (for
example every 15 minutes), which includes the mounted external storage.
Starting with Nextcloud 9.0, the data/mount.json file for configuring external storages has been removed, and
replaced with a set of occ commands.
Nextcloud storage backends accept one or more authentication schemes such as passwords, OAuth, or token-based,
to name a few examples. Each authentication scheme may be implemented by combining multiple authentication
mechanisms. Different mechanisms require different configuration parameters, depending on their behavior.
The None authentication mechanism requires no configuration parameters, and is used when a backend requires no
authentication.
The Built-in authentication mechanism itself requires no configuration parameters, but is used as a placeholder for
legacy storages that have not been migrated to the new system and do not take advantage of generic authentication
mechanisms. The authentication parameters are provided directly by the backend.
The Username and password mechanism requires a manually-defined username and password. These get passed
directly to the backend and are specified during the setup of the mount point.
The Log-in credentials, save in session mechanism uses the Nextcloud login credentials of the user to connect to
the storage. These are not stored anywhere on the server, but rather in the user session, giving increased security.
The drawbacks are that sharing is disabled when this mechanism is in use, as Nextcloud has no access to the storage
credentials, and background file scanning does not work.
The Log-in credentials, save in database mechanism uses the Nextcloud login credentials of the user to connect to
the storage. These are stored in the database encrypted with the shared secret. This allows to share files from within
this mount point.
The User entered, store in database mechanism work in the same way as the “Username and password” mechanism
but the credentials need to be specified by each user individually. Before the first access to that mount point the user
will be prompted to enter the credentials.
The Global credentials mechanism uses the general input field for “Global credentials” in the external storage settings
section as source for the credentials instead of individual credentials for a mount point.
Currently only the RSA mechanism is implemented, where a public/private keypair is generated by Nextcloud and the
public half shown in the GUI. The keys are generated in the SSH format, and are currently 1024 bits in length. Keys
can be regenerated with a button in the GUI.
6.7.4 OAuth
OAuth 1.0 and OAuth 2.0 are both implemented, but currently limited to the Dropbox and Google Drive backends re-
spectively. These mechanisms require additional configuration at the service provider, where an app ID and app secret
are provided and then entered into Nextcloud. Then Nextcloud can perform an authentication request, establishing the
storage connection.
The primary purpose of the Nextcloud server-side encryption is to protect users’ files on remote storage, such as
Dropbox and Google Drive, and to do it easily and seamlessly from within Nextcloud.
In Nextcloud 9.0 the server-side encryption separates encryption of local and remote storage. This allows you to
encrypt remote storage, such as Dropbox and Google, without having to also encrypt your home storage on your
Nextcloud server.
Note: Starting with Nextcloud 9.0 we support Authenticated Encryption for all newly encrypted files. See https:
//hackerone.com/reports/108082 for more technical information about the impact.
For maximum security make sure to configure external storage with “Check for changes: Never”. This will let
Nextcloud ignore new files not added via Nextcloud, so a malicious external storage administrator could not add
new files to the storage without your knowledge. Of course, this is not wise if your external storage is subject to
legitimate external changes.
Nextcloud server-side encryption encrypts files stored on the Nextcloud server, and files on remote storage that is
connected to your Nextcloud server. Encryption and decryption are performed on the Nextcloud server. All files sent
to remote storage will be encrypted by the Nextcloud server, and upon retrieval, decrypted before serving them to you
and anyone you have shared them with.
Note: Encrypting files increases their size by roughly 35%, so you must take this into account when you are provi-
sioning storage and setting storage quotas. User’s quotas are based on the unencrypted file size, and not the encrypted
file size.
When files on external storage are encrypted in Nextcloud, you cannot share them directly from the external storage
services, but only through Nextcloud sharing because the key to decrypt the data never leaves the Nextcloud server.
Nextcloud’s server-side encryption generates a strong encryption key, which is unlocked by user’s passwords. Your
users don’t need to track an extra password, but simply log in as they normally do. It encrypts only the contents of
files, and not filenames and directory structures.
You should regularly backup all encryption keys to prevent permanent data loss. The encryption keys are stored in the
following directories:
data/<user>/files_encryption Users’ private keys and all other keys necessary to decrypt the users’ files
data/files_encryption private keys and all other keys necessary to decrypt the files stored on a system wide
external storage
When encryption is enabled, all files are encrypted and decrypted by the Nextcloud application, and stored encrypted
on your remote storage. This protects your data on externally hosted storage. The Nextcloud admin and the storage
admin will see only encrypted files when browsing backend storage.
Warning: Encryption keys are stored only on the Nextcloud server, eliminating exposure of your data to third-
party storage providers. The encryption app does not protect your data if your Nextcloud server is compromised,
and it does not prevent Nextcloud administrators from reading user’s files. This would require client-side encryp-
tion, which this app does not provide. If your Nextcloud server is not connected to any external storage services
then it is better to use other encryption tools, such as file-level or whole-disk encryption.
Note also that SSL terminates at or before Apache on the Nextcloud server, and all files will exist in an unencrypted
state between the SSL connection termination and the Nextcloud code that encrypts and decrypts files. This is also
potentially exploitable by anyone with administrator access to your server. Read How Nextcloud uses encryption
to protect your data for more information.
Plan very carefully before enabling encryption because it is not reversible via the Nextcloud Web interface. If you lose
your encryption keys your files are not recoverable. Always have backups of your encryption keys stored in a safe
location, and consider enabling all recovery options.
You have more options via the occ command (see occ encryption commands)
Nextcloud encryption consists of two parts. The base encryption system is enabled and disabled on your Admin page.
First you must enable this, and then select an encryption module to load. Currently the only available encryption
module is the Nextcloud Default Encryption Module.
First go to the Server-side encryption section of your Admin page and check Enable server-side encryption. You
have one last chance to change your mind.
After clicking the Enable Encryption button you see the message “No encryption module loaded, please load a
encryption module in the app menu”, so go to your Apps page to enable the Nextcloud Default Encryption Module.
Return to your Admin page to see the Nextcloud Default Encryption Module added to the module selector, and auto-
matically selected. Now you must log out and then log back in to initialize your encryption keys.
When you log back in, there is a checkbox for enabling encryption on your home storage. This is checked by default.
Un-check to avoid encrypting your home storage.
After encryption is enabled your users must also log out and log back in to generate their personal encryption keys.
They will see a yellow warning banner that says “Encryption App is enabled but your keys are not initialized, please
log-out and log-in again.”
Share owners may need to re-share files after encryption is enabled; users trying to access the share will see a message
advising them to ask the share owner to re-share the file with them. For individual shares, un-share and re-share the
file. For group shares, share with any individuals who can’t access the share. This updates the encryption, and then
the share owner can remove the individual shares.
You and your users can encrypt individual external mountpoints. You must have external storage enabled on your
Admin page, and enabled for your users.
Encryption settings can be configured in the mount options for an external storage mount, see Mount options (Config-
uring External Storage (GUI))
If you lose your Nextcloud password, then you lose access to your encrypted files. If one of your users loses their
Nextcloud password their files are unrecoverable. You cannot reset their password in the normal way; you’ll see a
yellow banner warning “Please provide an admin recovery password, otherwise all user data will be lost”.
To avoid all this, create a Recovery Key. Go to the Encryption section of your Admin page and set a recovery key
password.
Then your users have the option of enabling password recovery on their Personal pages. If they do not do this, then
the Recovery Key won’t work for them.
For users who have enabled password recovery, give them a new password and recover access to their encrypted files
by supplying the Recovery Key on the Users page.
If you have shell access you may use the occ command to perform encryption operations, and you have additional
options such as decryption and creating a single master encryption key. See Encryption for detailed instructions on
using occ.
Get the current status of encryption and the loaded encryption module:
occ encryption:status
- enabled: false
- defaultModule: OC_DEFAULT_MODULE
occ encryption:enable
Encryption enabled
occ encryption:list-modules
- OC_DEFAULT_MODULE: Default encryption module [default*]
Select a different default Encryption module (currently the only available module is OC_DEFAULT_MODULE):
occ encryption:encrypt-all
You are about to start to encrypt all files stored in your Nextcloud.
It will depend on the encryption module you use which files get encrypted.
Depending on the number and size of your files this can take some time.
Please make sure that no users access their files during this process!
When you type y it creates a key pair for each of your users, and then encrypts their files, displaying progress until all
user files are encrypted.
Decrypt all user data files, or optionally a single user:
occ encryption:show-key-storage-root
Current key storage root: default storage location (data/)
Move keys to a different folder, either locally or on a different server. The folder must already exist, be owned by
root and your HTTP group, and be restricted to root and your HTTP group. Further the folder needs to be located
somewhere in your Nextcloud data folder, either physically, or as a mount. This example is for Ubuntu Linux. Note
that the new folder is relative to your occ directory:
cd /your/nextcloud/data
mkdir keys
chown -R root:www-data keys
chmod -R 0770 keys
occ encryption:change-key-storage-root keys
Start to move keys:
4 [============================]
Key storage root successfully changed to keys
Create a new master key. Use this when you have a single-sign on infrastructure. Use this only on fresh installations
with no existing data, or on systems where encryption has not already been enabled. It is not possible to disable it:
occ encryption:enable-master-key
You may disable encryption only with occ. Make sure you have backups of all encryption keys, including users’. Put
your Nextcloud server into maintenance mode, and then disable your encryption module with this command:
Only the data in the files in data/user/files are encrypted, and not the filenames or folder structures. These
files are never encrypted:
• Existing files in the trash bin & Versions. Only new and changed files after encryption is enabled are encrypted.
• Existing files in Versions
• Image thumbnails from the Gallery app
• Previews from the Files app
• The search index from the full text search app
• Third-party app data
There may be other files that are not encrypted; only files that are exposed to third-party storage providers are guaran-
teed to be encrypted.
If you use an external user back-end, such as an LDAP or Samba server, and you change a user’s password on the
back-end, the user will be prompted to change their Nextcloud login to match on their next Nextcloud login. The user
will need both their old and new passwords to do this. If you have enabled the Recovery Key then you can change a
user’s password in the Nextcloud Users panel to match their back-end password, and then, of course, notify the user
and give them their new password.
Nextcloud’s Transactional File Locking mechanism locks files to avoid file corruption during normal operation. It
performs these functions:
• Operates at a higher level than the filesystem, so you don’t need to use a filesystem that supports locking
• Locks parent directories so they cannot be renamed during any activity on files inside the directories
• Releases locks after file transactions are interrupted, for example when a sync client loses the connection during
an upload
• Manages locking and releasing locks correctly on shared files during changes from multiple users
• Manages locks correctly on external storage mounts
• Manages encrypted files correctly
What Transactional File locking is not for: it will not prevent multiple users from editing the same document, or give
notice that other users are working on the same document. Multiple users can open and edit a file at the same time and
Transactional File locking does not prevent this. Rather, it prevents simultaneous file saving.
File locking is enabled by default, using the database locking backend. This places a significant load on your database.
Using memcache.locking relieves the database load and improves performance. Admins of Nextcloud servers
with heavy workloads should install a memcache. (See Configuring memory caching.)
To use a memcache with Transactional File Locking, you must install the Redis server and corresponding PHP module.
After installing Redis you must enter a configuration in your config.php file like this example:
Note: For enhanced security it is recommended to configure Redis to require a password. See http://redis.io/topics/
security for more information.
If you want to configure Redis to listen on an Unix socket (which is recommended if Redis is running on the same
system as Nextcloud) use this example config.php configuration:
See config.sample.php to see configuration examples for Redis, and for all supported memcaches.
If you are on Ubuntu you can follow this guide for a complete installation from scratch.
Learn more about Reds at Redis. Memcached, the popular distributed memory caching system, is not suitable for the
new file locking because it is not designed to store locks, and data can disappear from the cache at any time. Redis is
a key-value store, and it guarantees that cached objects are available for as long as they are needed.
The Nextcloud thumbnail system generates previews of files for all Nextcloud apps that display files, such as Files and
Gallery.
The following image shows some examples of previews of various file types.
Note: Technically Nextcloud can also generate the previews of other file types such as PDF, SVG or various office
documents. Due to security concerns those providers have been disabled by default and are considered unsupported.
While those providers are still available, we discourage enabling them, and they are not documented.
6.10.1 Parameters
Please notice that the Nextcloud preview system comes already with sensible defaults, and therefore it is usually
unnecessary to adjust those configuration values.
Disabling previews:
Under certain circumstances, for example if the server has limited resources, you might want to consider disabling the
generation of previews. Note that if you do this all previews in all apps are disabled, including the Gallery app, and
will display generic icons instead of thumbnails.
Set the configuration option enable_previews in config.php to false:
<?php
'enable_previews' => false,
There are two configuration options to set the maximum size of a preview.
<?php
'preview_max_x' => null,
'preview_max_y' => null,
By default, both options are set to null. ‘Null’ is equal to no limit. Numeric values represent the size in pixels. The
following code limits previews to a maximum size of 100×100px:
<?php
'preview_max_x' => 100,
'preview_max_y' => 100,
If a lot of small pictures are stored on the Nextcloud instance and the preview system generates blurry previews, you
might want to consider setting a maximum scale factor. By default, pictures are upscaled to 10 times the original size:
<?php
'preview_max_scale_factor' => 10,
If you want to disable scaling at all, you can set the config value to ‘1’:
<?php
'preview_max_scale_factor' => 1,
If you want to disable the maximum scaling factor, you can set the config value to ‘null’:
<?php
'preview_max_scale_factor' => null,
The Versions app (files_versions) expires old file versions automatically to ensure that users don’t exceed their storage
quotas. This is the default pattern used to delete old versions:
• For the first second we keep one version
• For the first 10 seconds Nextcloud keeps one version every 2 seconds
• For the first minute Nextcloud keeps one version every 10 seconds
• For the first hour Nextcloud keeps one version every minute
• For the first 24 hours Nextcloud keeps one version every hour
• For the first 30 days Nextcloud keeps one version every day
• After the first 30 days Nextcloud keeps one version every week
The versions are adjusted along this pattern every time a new version is created.
The Versions app never uses more that 50% of the user’s currently available free space. If the stored versions exceed
this limit, Nextcloud deletes the oldest file versions until it meets the disk space limit again.
You may alter the default pattern in config.php. The default setting is auto, which sets the default pattern:
SEVEN
FILE WORKFLOWS
Nextcloud’s File Access Control app enables administrators to create and manage a set of rule groups. Each of the
rule groups consists of one or more rules. If all rules of a group hold true, the group matches the request and access is
being denied. The rules criteria range from IP address, to user groups, collaborative tags and some more.
If access to a file has been denied for a user, the user can not:
• Create/upload the file
• Modify the files
• Delete the file
• Download the file
• Syncronise the file with clients, such as the Nextcloud desktop and mobile clients
7.1.2 Examples
After installing the File Access Control app as described in Installing and managing apps navigate to the configuration
and locate the File Access Control settings.
205
Nextcloud Server Administration Manual, Release 14
The first rule group Support only 9-5 denies any access to files for users of the Support user group, between
5pm and 9am.
The second rule group Internal testing prevents users of the Internal testers group to access files from outside
of the local network.
The easiest way to block access to a folder, is to use a collaborative tag. As mentioned in the Available rules section
below, either the file itself or one of the parents needs to have the given tag assigned.
So you just need to assign the tag to the folder or file, and then block the tag with a rule group. The check is independent
of the user’s permissions for the tag. Therefor restricted and invisible tags are recommended, otherwise a user could
remove and reassign the tag.
This example blocks access to any folder with the tag Confidential.
It’s possible to prevent specific files from being uploaded to Nextcloud. You simply need to define a rule based on the
mimetype and our powerful access control engine will block any attempt to upload the file. The safest way to define
the rule is to use a regular expression, as it will help you cover all the known media types used for the type of file
you’re trying to block.
The following example prevents zip files from being uploaded by using the regular expression: /^application\/
(zip|x-zip-compressed)$/i
When trying to deny access to a group of users, make sure that sharing does not allow them to create a way back in.
When users are able to create a public link, the users can log themselves out and visit their own public link to access
the files. Since at this point they are no user and therefor no member of the blocked group, they will be able to read
and change the file.
The recommended work around is to create the same rule again, and deny access for all users that are not member
of a group, that contains all users of your installation.
External storage
While access to files in external storages is not possible via Nextcloud, users that have direct access to the external
storage, can of course change files there directly. Therefor it is recommended to disable the Allow users to
mount external storage option, when trying to to completely lock out users.
All rules can also be inverted (from is to is not) using the operator option.
• File collaborative tag: Either the file itself, or any of the file owner’s parent folders needs to be tagged with the
tag.
Note: Tags used in access control rules should be restricted tags, otherwise any user can remove the tag to
access the file again. The best way to do this is with the Automated tagging of files.
• Request remote address: An IP range (either v4 or v6) for the accessing user
• Request time: Time span and timezone when the request happens
• Request URL: The URL which requests the file. (This is the URL the file is served from, not the URL the user
is currently looking at.)
• Request user agent: The user agent of the users browser or client. Nextcloud desktop, Android and iOS clients
are available as preconfigured options.
• User group membership: Whether the user is a member of the given group.
Nextcloud’s Files Automated Tagging app allows to assign collaborative tags to files and folders based on rules, similar
to Files access control.
The main functionality of this app is to allow users to indirectly assign restricted and invisible tags to files they upload.
This is especially useful for retention and Files access control, so people that got the files shared can not remove the
tag to stop the retention or allow access against the owners will.
7.2.2 Example
After installing the Files automated tagging app as described in Installing and managing apps navigate to the config-
uration and locate the Workflow settings.
In the example you can see a simple rule with only one condition. It will tag all files with the restricted tag
Protected file that are uploaded into a folder that is tagged with Protect content. No user can remove
the tag Protected file and therefor access control and retention both work fine without users being able to work
around them.
The available rules can be seen in the access control section: Available rules.
It is possible to execute actions like `convert to PDF` based on assigned tags. Nextcloud GmbH assists cus-
tomers in this with hands-on help and documentation on our customer portal.
Nextcloud’s Files Retention app allows to automatically delete files that are tagged with a collaborative tag and have a
certain age.
7.3.1 Example
After installing the Retention app as described in Installing and managing apps navigate to the configuration and
locate the Workflow settings.
The rule from the example will delete all files tagged with Temporary file after 14 days.
Similar to Files access control retention should use restricted or invisible tags. Otherwise any user can
remove the tag and the file is not removed after the given period. Use Automated tagging of files to assign such tags to
newly uploaded files.
File age
Currently retention is based on the creation date of the file. The sync client sends the original creation date to the
server, while uploading through the web interface will create a new file with a new creation date. We hope to be able
to add a upload date to the filesystem soon, which would make more sense. Until then this potentially unexpected
behavior has to be taken into account.
EIGHT
DATABASE CONFIGURATION
You can convert a SQLite database to a better performing MySQL, MariaDB or PostgreSQL database with the
Nextcloud command line tool. SQLite is good for testing and simple single-user Nextcloud servers, but it does not
scale for multiple-user production users.
First set up the new database, here called “new_db_name”. In Nextcloud root folder call
The Options
• --port="3306" the database port (optional)
• --password="mysql_user_password" password for the new database. If omitted the tool will ask you
(optional)
• --clear-schema clear schema (optional)
• --all-apps by default, tables for enabled apps are converted, use to convert also tables of deactivated apps
(optional)
Note: The converter searches for apps in your configured app folders and uses the schema definitions in the apps to
create the new table. So tables of removed apps will not be converted even with option --all-apps
For example
To successfully proceed with the conversion, you must type yes when prompted with the question Continue with
the conversion?
On success the converter will automatically configure the new database in your Nextcloud config config.php.
If you updated your Nextcloud instance, there might be remnants of old tables which are not used any more. The
updater will tell you which ones these are.
211
Nextcloud Server Administration Manual, Release 14
You can ignore these tables. Here is a list of known old tables:
• oc_calendar_calendars
• oc_calendar_objects
• oc_calendar_share_calendar
• oc_calendar_share_event
• oc_fscache
• oc_log
• oc_media_albums
• oc_media_artists
• oc_media_sessions
• oc_media_songs
• oc_media_users
• oc_permissions
• oc_queuedtasks
• oc_sharing
Nextcloud requires a database in which administrative data is stored. The following databases are currently supported:
• MySQL / MariaDB
• PostgreSQL
• Oracle
The MySQL or MariaDB databases are the recommended database engines.
8.2.1 Requirements
Choosing to use MySQL / MariaDB, PostgreSQL, or Oracle as your database requires that you install and set up the
server software first.
Note: The steps for configuring a third party database are beyond the scope of this document. Please refer to the
documentation for your specific database choice for instructions.
As discussed above Nextcloud is using the TRANSACTION_READ_COMMITTED transaction isolation level. Some
database configurations are enforcing other transaction isolation levels. To avoid data loss under high load scenar-
ios (e.g. by using the sync client with many clients/users and many parallel operations) you need to configure the
transaction isolation level accordingly. Please refer to the MySQL manual for detailed information.
8.2.2 Parameters
For setting up Nextcloud to use any database, use the instructions in Installation wizard. You should not have to edit
the respective values in the config/config.php. However, in special cases (for example, if you want to connect
your Nextcloud instance to a database created by a previous installation of Nextcloud), some modification might be
required.
[mysqld]
...
transaction_isolation = READ-COMMITTED
binlog_format = ROW
...
[server]
skip-name-resolve
innodb_buffer_pool_size = 128M
innodb_buffer_pool_instances = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 32M
innodb_max_dirty_pages_pct = 90
query_cache_type = 1
query_cache_limit = 2M
query_cache_min_res_unit = 2k
query_cache_size = 64M
tmp_table_size= 64M
max_heap_table_size= 64M
slow-query-log = 1
slow-query-log-file = /var/log/mysql/slow.log
long_query_time = 1
[client-server]
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
[client]
default-character-set = utf8mb4
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
transaction_isolation = READ-COMMITTED
binlog_format = ROW
innodb_large_prefix=on
innodb_file_format=barracuda
innodb_file_per_table=1
Note: MariaDB is backwards compatible with MySQL. All instructions work for both. You will not need to replace
mysql with anything.
[mysql]
mysql.allow_local_infile=On
mysql.allow_persistent=On
mysql.cache_size=2000
mysql.max_persistent=-1
mysql.max_links=-1
mysql.default_port=
mysql.default_socket=/var/lib/mysql/mysql.sock # Debian squeeze: /var/run/mysqld/
˓→mysqld.sock
mysql.default_host=
mysql.default_user=
mysql.default_password=
mysql.connect_timeout=60
mysql.trace_mode=Off
Now you need to create a database user and the database itself by using the MySQL command line interface. The
database tables will be created by Nextcloud when you login for the first time.
To start the MySQL command line mode use:
mysql -uroot -p
Then a mysql> or MariaDB [root]> prompt will appear. Now enter the following lines and confirm them with the
enter key:
FLUSH privileges;
quit
quit;
An Nextcloud instance configured with MySQL would contain the hostname on which the database is running, a valid
username and password to access it, and the name of the database. The config/config.php as created by the
Installation wizard would therefore contain entries like this:
<?php
PostgreSQL database
If you decide to use a PostgreSQL database make sure that you have installed and enabled the PostgreSQL extension
in PHP. The PHP configuration in /etc/php7/conf.d/pgsql.ini could look like this:
[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
The default configuration for PostgreSQL (at least in Ubuntu 14.04) is to use the peer authentication method. Check
/etc/postgresql/9.3/main/pg_hba.conf to find out which authentication method is used in your setup.
To start the postgres command line mode use:
Then a template1=# prompt will appear. Now enter the following lines and confirm them with the enter key:
A Nextcloud instance configured with PostgreSQL would contain the path to the socket on which the database is
running as the hostname, the system username the PHP process is using, and an empty password to access it, and
the name of the database. The config/config.php as created by the Installation wizard would therefore contain
entries like this:
<?php
Note: The host actually points to the socket that is used to connect to the database. Using localhost here will not
work if postgreSQL is configured to use peer authentication. Also note that no password is specified, because this
authentication method doesn’t use a password.
If you use another authentication method (not peer), you’ll need to use the following steps to get the database setup:
Now you need to create a database user and the database itself by using the PostgreSQL command line interface. The
database tables will be created by Nextcloud when you login for the first time.
To start the postgres command line mode use:
psql -hlocalhost -Upostgres
Then a postgres=# prompt will appear. Now enter the following lines and confirm them with the enter key:
CREATE USER username WITH PASSWORD 'password';
CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE nextcloud OWNER TO username;
GRANT ALL PRIVILEGES ON DATABASE nextcloud TO username;
A Nextcloud instance configured with PostgreSQL would contain the hostname on which the database is running, a
valid username and password to access it, and the name of the database. The config/config.php as created by
the Installation wizard would therefore contain entries like this:
<?php
8.2.3 Troubleshooting
How to work around “general error: 2006 MySQL server has gone away”
The database request takes too long and therefore the MySQL server times out. It’s also possible that the server is
dropping a packet that is too large. Please refer to the manual of your database for how to raise the configuration
options wait_timeout and/or max_allowed_packet.
Some shared hosters are not allowing the access to these config options. For such systems Nextcloud is providing a
dbdriveroptions configuration option within your config/config.php where you can pass such options to
the database driver. Please refer to Configuration Parameters for an example.
To check the server’s network availability, use the ping command on the server’s host name (db.server.com in this
example):
ping db.server.dom
For a more detailed check whether the access to the database server software itself works correctly, see the next
question.
The easiest way to test if a database is accessible is by starting the command line interface:
MySQL:
Assuming the database server is installed on the same system you’re running the command from, use:
mysql -uUSERNAME -p
To access a MySQL installation on a different machine, add the -h option with the respective host name:
mysql -uUSERNAME -p -h HOSTNAME
PostgreSQL:
Assuming the database server is installed on the same system you’re running the command from, use:
To access a MySQL installation on a different machine, add the -h option with the respective host name:
(1 row)
postgres=# \q
Quit Database:
MySQL : quit
PostgreSQL: \q
In order to use Emojis (textbased smilies) on your Nextcloud server with a MySQL database, the installation needs to
be tweaked a bit.
1. Make sure the following InnoDB settings are set on your MySQL server:
(a) MySQL 8.0 or later:
[mysqld]
innodb_file_per_table=1
[mysqld]
innodb_large_prefix=true
innodb_file_format=barracuda
innodb_file_per_table=1
2. Restart the MySQL server in case you changed the configuration in step 1.
5. Convert all existing tables to the new collation by running the repair step:
Now you should be able to use Emojis in your file names, calendar events, comments and many more.
1. Make sure the following InnoDB settings are set on your MariaDB server:
[mysqld]
innodb_file_per_table=1
1. Make sure the following InnoDB settings are set on your MySQL server:
[mysqld]
innodb_large_prefix=true
innodb_file_format=barracuda
innodb_file_per_table=1
2. Restart the MariaDB server in case you changed the configuration in step 1.
3. Figure out whether the file format was changed to Barracuda:
If the file format is “Barracuda” for every single table, nothing special is left to do. Continue with the MySQL
instructions at step 3. While testing, all tables’ file format was “Antelope”.
4. The tables needs to be migrated to “Barracuda” manually, one by one. SQL commands can be created easily,
however:
This will return an SQL command for each table in the nextcloud database. The rows can be quickly copied into a
text editor, the “|”s replaced and the SQL commands copied back to the MariaDB shell. If no error appeared (in doubt
check step 2) all is done and nothing is left to do here. It can be proceded with the MySQL steps.
5. It is possible, however, that some tables cannot be altered. The operations fails with: “ERROR 1478 (HY000):
Table storage engine ‘InnoDB’ does not support the create option ‘ROW_FORMAT’”. In that case the failing
tables have a SPACE value of 0 in step 2. It basically means that the table does not have an index file of its own,
which is required for the Barracuda format. This can be solved with a slightly different SQL command:
Replace oc_tablename with the failing table. If there are too many (did not happen here), SQL commands can be
generated in a batch (task for the reader).
6. Now everything should be fine and the MySQL instructions can be followed from step 3 onwards
Since Nextcloud 13 big integers are used to store identifiers and auto-increment keys in the database. Because changing
columns on huge tables can take quite a while (up to hours or days), the update from Nextcloud 12 or earlier did not
perform this migration on the filecache and activity table.
To make it easy to force the update on those tables too, we’ve added a console command, which can be used to migrate
the remaining columns to bigints.
The command can safely be executed. It will show a success message when there is nothing to do:
Note: Similar to a normal update, you should shutdown your apache or nginx server or enable maintenance mode
before running the command to avoid issues with your sync clients.
NINE
MIMETYPES MANAGEMENT
Nextcloud allows you to create aliases for mimetypes, so that you can display custom icons for files. For example, you
might want a nice audio icon for audio files instead of the default file icon.
By default Nextcloud is distributed with nextcloud/resources/config/mimetypealiases.dist.
json. Do not modify this file, as it will be replaced when Nextcloud is updated. Instead, create your own
nextcloud/config/mimetypealiases.json file with your custom aliases. Use the same syntax as in
nextcloud/resources/config/mimetypealiases.dist.json.
Once you have made changes to your mimetypealiases.json, use the occ command to propagate the changes
through the system. This example is for Ubuntu Linux:
Nextcloud allows administrators to specify the mapping of a file extension to a mimetype. For example files ending in
mp3 map to audio/mpeg. Which then in turn allows Nextcloud to show the audio icon.
By default Nextcloud comes with mimetypemapping.dist.json. This is a simple json array. Administrators
should not update this file as it will get replaced on upgrades of Nextcloud. Instead the file mimetypemapping.
json should be created and modified, this file has precedence over the shipped file.
221
Nextcloud Server Administration Manual, Release 14
When an icon is retrieved for a mimetype, if the full mimetype cannot be found, the search will fallback to looking
for the part before the slash. Given a file with the mimetype ‘image/my-custom-image’, if no icon exists for the full
mimetype, the icon for ‘image’ will be used instead. This allows specialised mimetypes to fallback to generic icons
when the relevant icons are unavailable.
TEN
MAINTENANCE
10.1 Backup
To backup an Nextcloud installation there are four main things you need to retain:
1. The config folder
2. The data folder
3. The theme folder
4. The database
maintenance:mode locks the sessions of logged-in users and prevents new logins in order to prevent inconsisten-
cies of your data. You must run occ as the HTTP user, like this example on Ubuntu Linux:
You may also put your server into this mode by editing config/config.php. Change "maintenance" =>
false to "maintenance" => true:
<?php
Simply copy your config, data and theme folders (or even your whole Nextcloud install and data folder) to a place
outside of your Nextcloud environment. You could use this command:
223
Nextcloud Server Administration Manual, Release 14
MySQL/MariaDB
MySQL or MariaDB, which is a drop-in MySQL replacement, is the recommended database engine. To backup
MySQL/MariaDB:
SQLite
PostgreSQL
To restore a Nextcloud installation there are four main things you need to restore:
1. The configuration directory
2. The data directory
3. The database
4. The theme directory
Note: You must have both the database and data directory. You cannot complete restoration unless you have both of
these.
When you have completed your restoration, also make sure to run the maintenance:data-fingerprint command after-
wards, to ensure your sync clients can recover from the restored backup.
Note: This guide assumes that your previous backup is called “nextcloud-dirbkp”
Simply copy your configuration and data folder (or even your whole Nextcloud install and data folder) to your
Nextcloud environment. You could use this command:
Warning: Before restoring a backup you need to make sure to delete all existing database tables.
The easiest way to do this is to drop and recreate the database. SQLite does this automatically.
MySQL
If you use UTF8 with multibyte support (e.g. for emoijs in filenames), use:
PostgreSQL
10.2.3 Restoring
Note: This guide assumes that your previous backup is called “nextcloud-sqlbkp.bak”
MySQL
SQLite
rm data/owncloud.db
sqlite3 data/owncloud.db < nextcloud-sqlbkp.bak
PostgreSQL
Warning: Downgrading is not supported and risks corrupting your data! If you want to revert to an older
Nextcloud version, make a new, fresh installation and then restore your data from backup. Before doing this, file a
support ticket (if you have paid support) or ask for help in the Nextcloud forums to see if your issue can be resolved
without downgrading.
Nextcloud has an update notification app, that informs the administrator about the availability of an update. Then you
decide which update method to use.
Fig. 10.1: Figure 1: The top banner is the update notification that is shown on every page, and the Updates section
can be found in the admin page
From there the web based updater can be used to fetch this new code. There is also an CLI based updater available,
that does exactly the same as the web based updater but on the command line.
10.3.2 Prerequisites
You should always maintain regular backups and make a fresh backup before every upgrade.
Then review third-party apps, if you have any, for compatibility with the new Nextcloud release. Any apps that are not
developed by Nextcloud show a 3rd party designation. Install unsupported apps at your own risk. Then, before the
upgrade, all 3rd party apps must be disabled. After the upgrade is complete you may re-enable them.
You can put your Nextcloud server into maintenance mode before performing upgrades, or for performing trou-
bleshooting or maintenance. Please see Using the occ command to learn how to put your server into the maintenance
mode (maintenance:mode) or execute repair commands (maintenance:repair) with the occ command.
The build-in Updater does this for you before replacing the existing Nextcloud code with the code of the new
Nextcloud version.
maintenance:mode locks the sessions of logged-in users and prevents new logins. This is the mode to use for
upgrades. You must run occ as the HTTP user, like this example on Ubuntu Linux:
You may also put your server into this mode by editing config/config.php. Change "maintenance" =>
false to "maintenance" => true:
<?php
Some operation can be quite time consuming. Therefore we decided not to add them the the normal upgrade process.
We recommend to run them manually after the upgrade was completed. Below you find a list of this commands.
Upgrading to Nextcloud 13
With Nextcloud 13 we added a new index to the share table which should result in significant performance improve-
ments:
With Nextcloud 13 we switched to bigint for the file ID’s in the file cache table:
The built-in updater automates many of the steps of upgrading an Nextcloud installation. It is useful for installations
that do not have root access, such as shared hosting, for installations with a smaller number of users and data, and it
automates updating manual installations.
Warning: Downgrading is not supported and risks corrupting your data! If you want to revert to an older
Nextcloud version, install it from scratch and then restore your data from backup. Before doing this, file a support
ticket if you have paid support or ask for help in the Nextcloud forums to see if your issue can be resolved without
downgrading.
You should maintain regular backups (see Backup), and make a backup before every update. The built-in updater does
not backup your database or data directory.
Note: The updater itself only replaces the existing files with the ones from the version it updates to. The migration
steps needs to be executed afterwards. The command line mode provides a way to do this right after the code was
successfully replaced.
• Replace entry points: replaces all Nextcloud entry points with dummy files so that when those files are replaced
all clients still get the proper maintenance mode response. Examples for those endpoints are index.php,
remote.php or ocs/v1.php.
• Delete old files: deletes all files except the above mentioned entry points, the data and config dir as well as
non-shipped apps and themes. (And the updater itself of course)
• Move new files in place: moves the files from the extracted archive in place.
• Keep maintenance mode active?: asks you if the maintenance mode should be kept active. This allows the
admin to use the web based updater but run the actual migration steps (occ upgrade) on the command line.
If the maintenance mode is kept active command line access is required. To use the web based upgrade page
disable the maintenance mode and click the link to get to the upgrade page. (This step is only available in the
web based updater.)
• Done the update of the code is done and you either need to go to the linked page or to the command line to finish
the upgrade by executing the migration steps.
Using the built-in updater to update your Nextcloud installation is just a few steps:
1. You should see a notification at the top of any Nextcloud page when there is a new update available. Go to the
admin settings page and scroll to the section “Version”. This section has a button to open the updater. This
section as well as the update notification is only available if the update notication app is enabled in the apps
management.
3. Verify the information that is shown and click the button “Start update” to start the update.
4. In case an error happens or the check failed the updater stops processing and gives feedback. You can now try to
solve the problem and click the “Retry update” button. This will continue the update and re-run the failed step.
It will not re-run the previous succeeded steps.
5. In case you close the updater, before it finished you can just open the updater page again and proceed at the last
succeeded step. Closing the web page will still execute the running step but will not continue with the next one,
because this is triggered by the open updater page.
6. Once all steps are executed the updater will ask you a final question: “Keep maintenance mode active?”. This
allows you to use either the web based upgrade page or the command line based upgrade procedure (occ
upgrade). Command line access is required if the maintenance mode is kept active.
7. Done. You now can continue either to the web based upgrade page or run occ upgrade. The two examples
“Web based upgrade” and “Command line based upgrade” shows how the screens then look like.
Web based upgrade
This is how the web based update would continue:
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Updating <files_pdfviewer> ...
Updated <files_pdfviewer> to 1.1.1
Updating <gallery> ...
Updated <gallery> to 17.0.0
Updating <activity> ...
Updated <activity> to 2.5.2
Updating <comments> ...
Updated <comments> to 1.2.0
Updating <theming> ...
Updated <theming> to 1.3.0
Starting code integrity check...
Finished code integrity check
Update successful
Maintenance mode is kept active
Reset log level
The command line based updater works in the exact same way the web based updater works. The steps and checks are
the very same.
The steps are basically the same as for the web based updater:
1. You should see a notification at the top of any Nextcloud page when there is a new update available. Go to the
admin settings page and scroll to the section “Version”. This section has a button to open the updater. This
section as well as the update notification is only available if the update notication app is enabled in the apps
management.
2. Instead of clicking that button you can now invoke the command line based updater by going into the updater/
directory in the Nextcloud directory and executing the updater.phar as the web server user. (i.e. sudo -u
www-data php updater.phar)
3. Verify the information that is shown and enter “Y” to start the update.
4. In case an error happens or the check failed the updater stops processing and gives feedback. You can now try
to solve the problem and re-run the updater command. This will continue the update and re-run the failed step.
It will not re-run the previous succeeded steps.
6. Once all steps are executed the updater will ask you a final question: “Should the “occ upgrade” command be
executed?”. This allows you to directly execute the command line based upgrade procedure (occ upgrade).
If you select “No” then it will finish with Please now execute “./occ upgrade” to finish the upgrade..
7. Once the occ upgrade is done you get asked if the maintenance mode should be kept active.
It is possible to run the command line based updater in a non-interactive mode. The updater then doesn’t ask any in-
teractive questions. It is assumed that if an update is available it should be installed and the occ upgrade command
is executed as well. After finishing the maintenance mode will be turned off except an error occured during the occ
upgrade or the replacement of the code.
To execute this, run the command with the --no-interaction option. (i.e. sudo -u www-data php
updater.phar --no-interaction)
Always start by making a fresh backup and disabling all 3rd party apps.
1. Back up your existing Nextcloud Server database, data directory, and config.php file. (See Backup, for
restore information see Restoring backup)
2. Download and unpack the latest Nextcloud Server release (Archive file) from nextcloud.com/install/ into an
empty directory outside of your current installation.
Note: To unpack your new tarball, run: unzip nextcloud-[version].zip or tar -xjf nextcloud-[version].tar.bz2
6. Copy the config/config.php file from your old Nextcloud directory to your new Nextcloud directory.
7. If you keep your data/ directory in your nextcloud/ directory, copy it from your old version of Nextcloud
to your new nextcloud/. If you keep it outside of nextcloud/ then you don’t have to do anything with it,
because its location is configured in your original config.php, and none of the upgrade steps touch it.
8. If you are using 3rd party applications, look in your new nextcloud/apps/ directory to see if they are there.
If not, copy them from your old apps/ directory to your new one. Make sure the directory permissions of your
third party application directories are the same as for the other ones. ## THIS APPS part IS INSUFFICIENTLY
DOCUMENTED (needs better instructions)
9. Adjust file ownership and permissions:
(!) this MUST be executed from within your nextcloud installation directory
12. The upgrade operation takes a few minutes to a few hours, depending on the size of your installation. When it
is finished you will see a success message, or an error message that will tell where it went wrong.
Login and take a look at the bottom of your Admin page to verify the version number. Check your other settings to
make sure they’re correct. Go to the Apps page and review the core apps to make sure the right ones are enabled.
Re-enable your third-party apps.
10.5.2 Troubleshooting
Occasionally, files do not show up after a upgrade. A rescan of the files can help:
One effective, if unofficial method for keeping Nextcloud current on Linux servers is by configuring your system to
use Nextcloud via a self contained “Snap” package, A technology allowing users to always have the latest version of
an “app”.
That version from Canonical is quite restrictive. It is not aimed at developers or advanced users who would want to
tune their configuration by installing extra features. It is aimed at end-users who want a no-brainer solution. Install it,
use it. No need to worry about updating Nextcloud any more.
It will work for as long as Canonical pushes releases, just like with any other Linux package maintained independently
of Nextcloud.
10.6.2 Installation
After a successful install, assuming you and the device on which it was installed are on the same network, you
should be able to reach the Nextcloud installation by visiting .local in your browser. If your hostname is localhost or
localhost.localdomain, like on an Ubuntu Base device (IoT), nextcloud.local will be used instead.
You will be asked to create a password for “admin” and your favourite cloud will be ready
Note
Do not use on IoT devices yet. You probably don’t need these instructions anyway if you’re using Snappy Base 16.04
as it’s currently unreleased.
• Make a fresh backup.
• Upgrade your Nextcloud snap: sudo snap refresh nextcloud
• Run occ upgrade.
• Take your Nextcloud server out of maintenance mode.
• Re-enable third-party apps.
Upgrading Nextcloud from a Snap is just like upgrading any snap package. For example:
sudo snap refresh nextcloud
Your Snap package manager only upgrades the current Nextcloud Snap. Then your Nextcloud server is immediately
put into maintenance mode. You may not see this until you refresh your Nextcloud page.
Then use occ to complete the upgrade. You must run occ as your HTTP user. This example is for Debian/Ubuntu:
It is best to update your Nextcloud installation with every new point release, and to never skip any major releases.
While this requirement is being worked on, for the moment If you have skipped any major releases you can bring your
Nextcloud current with these steps:
If you are using a Snap package: sudo snap refresh nextcloud
If you did not install via a Snap package:
1. Upgrade your current version to the latest point release
2. Upgrade your current version to the next major release
3. Run upgrade routine
4. Repeat from step 2 until you reach the last available major release
You’ll find previous Nextcloud releases in the Nextcloud Server Changelog.
If upgrading via your Snap package manager fails, then you must perform a Upgrade manually.
If the need arises Nextcloud can be migrated to a different server. A typical use case would be a hardware change or a
migration from the virtual Appliance to a physical server. All migrations have to be performed with Nextcloud offline
and no accesses being made. Online migration is supported by Nextcloud only when implementing industry standard
clustering and HA solutions before Nextcloud is installed for the first time.
To start let us be specific about the use case. A configured Nextcloud instance runs reliably on one machine. For some
reason (e.g. more powerful machine is available but a move to a clustered environment not yet needed) the instance
needs to be moved to a new machine. Depending on the size of the Nextcloud instance the migration might take
several hours. As a prerequisite it is assumed that the end users reach the Nextcloud instance via a virtual hostname
(a CNAME record in DNS) which can be pointed at the new location. It is also assumed that the authentication method
(e.g. LDAP) remains the same after the migration.
Warning: At NO TIME any changes to the ORIGINAL system are required EXCEPT putting Nextcloud into
maintenance mode.
This ensures, should anything unforseen happen you can go back to your existing installation and provide your
users with a running Nextcloud while debugging the problem.
1. Set up the new machine with the desired OS, install and configure the Web server as well as PHP for Nextcloud
(e.g. permissions or file upload size limits) and make sure the PHP version matches Nextcloud supported con-
figuration and all relevant PHP extensions are installed. Also set up the database and make sure it is a Nextcloud
supported configuration. If your original machine was installed recently just copying that base configuration is
a safe best practice.
2. On the original machine then stop Nextcloud. First activate the maintenance mode. After waiting for 6-7
minutes for all sync clients to register the server as in maintenance mode stop the application and/or Web server
that serves Nextcloud.
3. Create a dump from the database and copy it to the new machine. There import it in the database (See Backup
and Restoring backup).
4. Copy all files from your Nextcloud instance, the Nextcloud program files, the data files, the log files and the
configuration files, to the new machine (See Backup and Restoring backup). The data files should keep their
original timestamp (can be done by using rsync with -t option) otherwise the clients will re-download all
the files after the migration. Depending on the original installation method and the OS the files are located
in different locations. On the new system make sure to pick the appropriate locations. If you change any
paths, make sure to adopt the paths in the Nextcloud config.php file. Note: This step might take several hours,
depending on your installation.
5. While still having Nextcloud in maintenance mode (confirm!) and BEFORE changing the CNAME record in
the DNS start up the database, Web server / application server on the new machine and point your web browser
to the migrated Nextcloud instance. Confirm that you see the maintenance mode notice, that a logfile entry is
written by both the Web server and Nextcloud and that no error messages occur. Then take Nextcloud out of
maintenance mode and repeat. Log in as admin and confirm normal function of Nextcloud.
6. Change the CNAME entry in the DNS to point your users to the new location.
Note: Especially when migrating from ownCloud to Nextcloud you should create a backup of the config, database
and the data directory, in case something goes wrong.
Currently migrating from ownCloud is like performing a manual update. So it is quite easy, to migrate from one
ownCloud version to at least one Nextcloud version. However this does only work with versions that are close enough
database and code-wise. See the table below for a version map, where migrating is easily possible:
ownCloud Nextcloud
10.0.1 or later 12.0.1 or later
10.0.0 12.0.0
9.1.x 10.0.x
9.0.x 10.0.x
9.0.x 9.0.x
Note: While we understand, that you want to migrate as soon as possible, we also don’t want to put your data at
risk. Since we never know what ownCloud changes in a future release, we only allow migrations from versions that
where released before our last maintenance release, so we can at least perform some basic migration tests, before you
migrate your production instance.
After downloading the correct version of Nextcloud from our older releases page, proceed like described in the Up-
grade manually manual.
Afterwards you can use the Nextcloud updater to update your instance to the newest version.
ELEVEN
If you have trouble installing, configuring or maintaining Nextcloud, please refer to our community support channels:
• The Nextcloud Forums The Nextcloud forums have a FAQ page where each topic corresponds to typical mis-
takes or frequently occurring issues
• The Nextcloud IRC chat channel irc://#[email protected] on freenode.net, also accessible
via webchat
Please understand that all these channels essentially consist of users like you helping each other out. Consider helping
others out where you can, to contribute back for the help you get. This is the only way to keep a community like
Nextcloud healthy and sustainable!
If you are using Nextcloud in a business or otherwise large scale deployment, note that Nextcloud GmbH offers
commercial support options.
11.1.1 Bugs
It might be possible that 3rd party / non-shipped apps are causing various different issues. Always disable 3rd party
apps before upgrades, and for troubleshooting. Please refer to the Apps commands on how to disable an app from
command line.
247
Nextcloud Server Administration Manual, Release 14
Nextcloud logfiles
In a standard Nextcloud installation the log level is set to Normal. To find any issues you need to raise the log level to
All in your config.php file, or to Everything on your Nextcloud Admin page. Please see Logging configuration
for more information on these log levels.
Some logging - for example JavaScript console logging - needs debugging enabled. Edit config/config.php
and change 'debug' => false, to 'debug' => true, Be sure to change it back when you are finished.
For JavaScript issues you will also need to view the javascript console. All major browsers have developer tools
for viewing the console, and you usually access them by pressing F12. For Firefox we recommend to installing the
Firebug extension.
You will need to know your PHP version and configurations. To do this, create a plain-text file named phpinfo.php
and place it in your Web root, for example /var/www/html/phpinfo.php. (Your Web root may be in a different
location; your Linux distribution documentation will tell you where.) This file contains just this line:
<?php phpinfo(); ?>
Your PHP version is at the top, and the rest of the page contains abundant system information such as active modules,
active .ini files, and much more. When you are finished reviewing your information you must delete phpinfo.
php, or move it outside of your Web directory, because it is a security risk to expose such sensitive data.
Warning: The data directory on the server is exclusive to Nextcloud and must not be modified manually.
If you need to directly upload files from the same server please use a WebDAV command line client like cadaver to
upload files to the WebDAV interface at:
https://example.com/nextcloud/remote.php/dav
Some common problems / error messages found in your logfiles as described above:
• SQLSTATE[HY000] [1040] Too many connections -> You need to increase the connection limit
of your database, please refer to the manual of your database for more information.
• SQLSTATE[HY000]: General error: 5 database is locked -> You’re using SQLite
which can’t handle a lot of parallel requests. Please consider converting to another database like described
in Converting database type.
• SQLSTATE[HY000]: General error: 2006 MySQL server has gone away -> Please re-
fer to Troubleshooting for more information.
• SQLSTATE[HY000] [2002] No such file or directory -> There is a problem accessing your
SQLite database file in your data directory (data/nextcloud.db). Please check the permissions of this
folder/file or if it exists at all. If you’re using MySQL please start your database.
• Connection closed / Operation cancelled -> This could be caused by wrong KeepAlive set-
tings within your Apache config. Make sure that KeepAlive is set to On and also try to raise the limits of
KeepAliveTimeout and MaxKeepAliveRequests.
• No basic authentication headers were found -> This error is shown in your data/
nextcloud.log file. Some Apache modules like mod_fastcgi, mod_fcgid or mod_proxy_fcgi
are not passing the needed authentication headers to PHP and so the login to Nextcloud via WebDAV, CalDAV
and CardDAV clients is failing. Information on how to correctly configure your environment can be found at the
forums.
Logfiles
When having issues the first step is to check the logfiles provided by PHP, the Web server and Nextcloud itself.
Note: In the following the paths to the logfiles of a default Debian installation running Apache2 with mod_php is
assumed. On other Web servers, Linux distros or operating systems they can differ.
Note: Lighttpd is not supported with Nextcloud, and some Nextcloud features may not work at all on Lighttpd.
There are some Web server or PHP modules which are known to cause various problems like broken up-/downloads.
The following shows a draft overview of these modules:
1. Apache
• mod_pagespeed
• mod_evasive
• mod_security
• mod_reqtimeout
• mod_deflate
• libapache2-mod-php5filter (use libapache2-mod-php5 instead)
• mod_spdy together with libapache2-mod-php5 / mod_php (use fcgi or php-fpm instead)
• mod_dav
• mod_xsendfile / X-Sendfile (causing broken downloads if not configured correctly)
2. NginX
• ngx_pagespeed
• HttpDavModule
• X-Sendfile (causing broken downloads if not configured correctly)
3. PHP
• eAccelerator
Nextcloud uses SabreDAV, and the SabreDAV documentation is comprehensive and helpful.
See:
• SabreDAV FAQ
• Web servers (Lists lighttpd as not recommended)
• Working with large files (Shows a PHP bug in older SabreDAV versions and information for mod_security
problems)
• 0 byte files (Reasons for empty files on the server)
• Clients (A comprehensive list of WebDAV clients, and possible problems with each one)
• Finder, OS X’s built-in WebDAV client (Describes problems with Finder on various Web servers)
There is also a well maintained FAQ thread available at the ownCloud Forums which contains various additional
information about WebDAV problems.
Service discovery
Some clients - especially on iOS/macOS - have problems finding the proper sync URL, even when explicitly configured
to use it.
If you want to use CalDAV or CardDAV clients together with Nextcloud it is important to have a correct working setup
of the following URLs:
https://example.com/.well-known/carddav
https://example.com/.well-known/caldav
Those need to be redirecting your clients to the correct DAV endpoints. If running Nextcloud at the document root of
your Web server the correct URL is:
https://example.com/remote.php/dav
and if running in a subfolder like nextcloud:
https://example.com/nextcloud/remote.php/dav
For the first case the .htaccess file shipped with Nextcloud should do this work for your when running Apache.
You need to make sure that your Web server is using this file. Additionally, you need the mod_rewrite Apache module
installed to process these redirects. When running Nginx please refer to Nginx configuration.
If your Nextcloud instance is installed in a subfolder called nextcloud and you’re running Apache create or edit the
.htaccess file within the document root of your Web server and add the following lines:
Some services like Cloudflare can cause issues by minimizing JavaScript and loading it only when needed. When
having issues like a not working login button or creating new users make sure to disable such services first.
Nextcloud supports code signing for the core releases, and for Nextcloud applications. Code signing gives our users
an additional layer of security by ensuring that nobody other than authorized persons can push updates.
It also ensures that all upgrades have been executed properly, so that no files are left behind, and all old files are
properly replaced. In the past, invalid updates were a significant source of errors when updating Nextcloud.
11.2.1 FAQ
By supporting Code Signing we add another layer of security by ensuring that nobody other than authorized persons
can push updates for applications, and ensuring proper upgrades.
The Nextcloud project is open source and always will be. We do not want to make it more difficult for our users to run
Nextcloud. Any code signing errors on upgrades will not prevent Nextcloud from running, but will display a warning
on the Admin page. For applications that are not tagged “Official” the code signing process is optional.
The Nextcloud project is open source and always will be. The code signing process is optional, though highly recom-
mended. The code check for the core parts of Nextcloud is enabled when the Nextcloud release version branch has
been set to stable.
For custom distributions of Nextcloud it is recommended to change the release version branch in version.php to
something else than “stable”.
A code integrity error message (“There were problems with the code integrity check. More information. . . ”) appears
in a yellow banner at the top of your Nextcloud Web interface:
Clicking on this link will take you to your Nextcloud admin page, which provides the following options:
To debug issues caused by the code integrity check click on “List of invalid files. . . ”, and you will be shown a text
document listing the different issues. The content of the file will look similar to the following example:
Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.
Results
=======
- core
- INVALID_HASH
- /index.php
- /version.php
- EXTRA_FILE
- /test.php
- calendar
- EXCEPTION
- OC\IntegrityCheck\Exceptions\InvalidSignatureException
- Signature data not found.
Raw output
==========
Array
(
[core] => Array
(
[INVALID_HASH] => Array
(
[/index.php] => Array
(
[expected] =>
f1c5e2630d784bc9cb02d5a28f55d6f24d06dae2a0fee685f3
c2521b050955d9d452769f61454c9ddfa9c308146ade10546c
fa829794448eaffbc9a04a29d216
[current] =>
ce08bf30bcbb879a18b49239a9bec6b8702f52452f88a9d321
42cad8d2494d5735e6bfa0d8642b2762c62ca5be49f9bf4ec2
31d4a230559d4f3e2c471d3ea094
)
d5685c3b45aee373b09be54742ea
[current] =>
88a3a92c11db91dec1ac3be0e1c87f862c95ba6ffaaaa3f2c3
b8f682187c66f07af3a3b557a868342ef4a271218fe1c1e300
c478e6c156c5955ed53c40d06585
)
Note: When using a FTP client to upload those files make sure it is using the Binary transfer mode instead of the
ASCII transfer mode.
11.2.3 Rescans
Rescans are triggered at installation, and by updates. You may run scans manually with the occ command. The first
command scans the Nextcloud server files, and the second command scans the named app. There is not yet a command
to manually scan all apps:
occ integrity:check-core
occ integrity:check-app $appid
See Using the occ command to learn more about using occ.
11.2.4 Errors
The following errors can be encountered when trying to verify a code signature.
• INVALID_HASH
– The file has a different hash than specified within signature.json. This usually happens when the
file has been modified after writing the signature data.
• MISSING_FILE
– The file cannot be found but has been specified within signature.json. Either a required file has been
left out, or signature.json needs to be edited.
• EXTRA_FILE
– The file does not exist in signature.json. This usually happens when a file has been removed and
signature.json has not been updated. It also happens if you have placed additional files in your
Nextcloud installation folder.
• EXCEPTION
– Another exception has prevented the code verification. There are currently these following exceptions: