OwnCloud Fix: New User Template – Could not create directory

OwnCloud is a community and enterprise-based file cloud sharing service, similar to Dropbox and looks like Google Drive.

Installation goes pretty smooth, until you go to edit your mail templates, and you can edit/save each one until you get to New User Email (HTML or PlainText) and you receive the “Could not create directory” error.

A look into the log file and you’ll see this:

mkdir(): Permission denied at /var/www/owncloud/apps/templateeditor/lib/mailtemplate.php#98

The Fix

You need to create a subdirectory custom theme directory called settings, and then a subfolder in settings named templates, then apply read/write permissions.  I’m assuming your base directory is /var/www, adjust as needed.

mkdir /var/www/<owncloud install dir>/themes/<your theme dir>/settings

mkdir /var/www/<owncloud install dir>/themes/<your theme dir>/settings/templates

chown www-data. /var/www/<owncloud install dir>/themes/<your theme dir>/settings -R

chmod 766 /var/www/<owncloud install dir>/themes/<your theme dir>/settings/templates

After this you should be able to save your New User HTML or Plain Text email template.