PermissionError: [Errno 13] Permission denied problem in version13

I notice something strange in version 13. I just create fresh version 13 server and try to create site and when it reach update doctype am getting [Errno 13] Permission denied. If run this chown -R frappe:frappe /home/frappe from the bench directore i try to create site it work. however time i close my terminal and come back to create or update a site i have to run this chown -R frappe:frappe /home/frappe command.

Traceback (most recent call last):
File “/usr/lib/python3.6/”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 104, in
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 19, in main
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 148, in reinstall
_reinstall(site, admin_password, mariadb_root_username, mariadb_root_password, yes, verbose=context.verbose)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/”, line 171, in _reinstall
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 79, in _new_site
install_app(app, verbose=verbose, set_as_patched=not source_sql)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 170, in install_app
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 22, in after_install
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 93, in install_basic_docs
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 238, in insert
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 961, in run_before_save_methods
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 859, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 1148, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 1131, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 853, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_domain/”, line 20, in validate
logger = frappe.logger()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 1649, in logger
return get_logger(module=module, with_more_info=with_more_info, allow_site=allow_site, filter=filter, max_size=max_size, file_count=file_count)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/”, line 61, in get_logger
handler = RotatingFileHandler(log_filename, maxBytes=max_size, backupCount=file_count)
File “/usr/lib/python3.6/logging/”, line 150, in init
BaseRotatingHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.6/logging/”, line 57, in init
logging.FileHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.6/logging/”, line 1032, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python3.6/logging/”, line 1061, in _open
return open(self.baseFilename, self.mode, encoding=self.encoding)
PermissionError: [Errno 13] Permission denied: ‘/home/frappe/frappe-bench/logs/frappe.log’

My Setup

  • ERP App Version 13
  • Ubuntu 18.4
  • Remote Database

sudo chown -R frappe:frappe /home/frappe

1 Like

this did not work for me unfortunately, anyone still facing this issue?

Yes. Facing the same issue.

are you using the user which was created for frappe/erpnext install for accessing CLI or using root or any other user ?

i had find out the username of the currently logged in user by running who -H on ubuntu, then ran this command: sudo chown -R <username>:<username> *
For Ex: sudo chown -R ubuntu:ubuntu *

similar/duplicate issue:

Helps to get back the system running when you happened to run regular bench commands with sudo.