PermissionError: [Errno 13] Permission denied: error when creating a second site

Hello Team,

I am trying to set up DNS-based multi-tenancy in ERPNext and Frappe, but on creating the second site, I get the error below. By any chance I can get pointers on why I can’t get passed this step?

erp@server2345:~/frappe-bench$ sudo bench new-site
[sudo] password for erp: 
MySQL root password: 
Restoring Database file...
11.9KiB 0:00:00 [ 327KiB/s] [======================================>] 100%            

Installing frappe...
Updating DocTypes for frappe        : [========================================] 100%
Traceback (most recent call last):
  File "/usr/lib/python3.8/", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.8/", line 87, in _run_code
    exec(code, run_globals)
  File "/home/erp/frappe-bench/apps/frappe/frappe/utils/", line 110, in <module>
  File "/home/erp/frappe-bench/apps/frappe/frappe/utils/", line 20, in main
  File "/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/", line 782, in main
    rv = self.invoke(ctx)
  File "/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/erp/frappe-bench/env/lib/python3.8/site-packages/click/", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/erp/frappe-bench/apps/frappe/frappe/commands/", line 74, in new_site
  File "/home/erp/frappe-bench/apps/frappe/frappe/", line 82, in _new_site
    install_app(app, verbose=verbose, set_as_patched=not source_sql)
  File "/home/erp/frappe-bench/apps/frappe/frappe/", line 196, in install_app
  File "/home/erp/frappe-bench/apps/frappe/frappe/utils/", line 25, in after_install
  File "/home/erp/frappe-bench/apps/frappe/frappe/utils/", line 142, in install_basic_docs
  File "/home/erp/frappe-bench/apps/frappe/frappe/model/", line 263, in insert
  File "/home/erp/frappe-bench/apps/frappe/frappe/model/", line 1054, in run_before_save_methods
  File "/home/erp/frappe-bench/apps/frappe/frappe/model/", line 943, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/erp/frappe-bench/apps/frappe/frappe/model/", line 1264, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/erp/frappe-bench/apps/frappe/frappe/model/", line 1246, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/erp/frappe-bench/apps/frappe/frappe/model/", line 940, in fn
    return method_object(*args, **kwargs)
  File "/home/erp/frappe-bench/apps/frappe/frappe/email/doctype/email_domain/", line 25, in validate
    logger = frappe.logger()
  File "/home/erp/frappe-bench/apps/frappe/frappe/", line 2042, in logger
    return get_logger(
  File "/home/erp/frappe-bench/apps/frappe/frappe/utils/", line 63, in get_logger
    handler = RotatingFileHandler(log_filename, maxBytes=max_size, backupCount=file_count)
  File "/usr/lib/python3.8/logging/", line 148, in __init__
    BaseRotatingHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/", line 55, in __init__
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.8/logging/", line 1147, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.8/logging/", line 1176, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: '/home/erp/frappe-bench/logs/frappe.log'

Seems permission error …

PermissionError: [Errno 13] Permission denied: '/home/erp/frappe-bench/logs/frappe.log'

Use frappe user for run bench commands. sudo should not needed for this kind of commands

Hope this helps.

erp is the frappe user in my case that I have been using all along. I fail to understand the origin of the permission error.

I think the solution is to grant yourself (User) access to the files using the chown or chmod command.

Try this,
chmod -R o+rx /home/erp
and :
sudo nano /etc/supervisor/supervisord.conf

(Add these lines under [unix_http_server])

you might also need to restart supervisor
sudo -A systemctl restart supervisor


I have tried adjusting supervisor as advised but the error is still persistent. Restarted the server as well after adjusting these parameters.

What baffles me is that I am able to drop sites using the same frappe user, which is erp in my case.