PermissionError: [Errno 13] Permission denied problem in version13

Hello,
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/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 104, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 19, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 829, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 782, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, 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/core.py”, 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/core.py”, line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 610, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 27, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, 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/site.py”, line 171, in _reinstall
admin_password=admin_password)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 79, in _new_site
install_app(app, verbose=verbose, set_as_patched=not source_sql)
File “/home/frappe/frappe-bench/apps/frappe/frappe/installer.py”, line 170, in install_app
frappe.get_attr(after_install)()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py”, line 22, in after_install
install_basic_docs()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/install.py”, line 93, in install_basic_docs
frappe.get_doc(d).insert()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 238, in insert
self.run_before_save_methods()
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 961, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 859, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1148, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, line 1131, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py”, 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/email_domain.py”, line 20, in validate
logger = frappe.logger()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, 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/logger.py”, line 61, in get_logger
handler = RotatingFileHandler(log_filename, maxBytes=max_size, backupCount=file_count)
File “/usr/lib/python3.6/logging/handlers.py”, line 150, in init
BaseRotatingHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.6/logging/handlers.py”, line 57, in init
logging.FileHandler.init(self, filename, mode, encoding, delay)
File “/usr/lib/python3.6/logging/init.py”, line 1032, in init
StreamHandler.init(self, self._open())
File “/usr/lib/python3.6/logging/init.py”, 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.