Jose Maria Andrades
Jose Maria Andrades

Reputation: 21

Permission denied creating group ckan 2.9.5

I'm having an issue with my ckan 2.9.5 instance while doing anything (create groups, organizations, uploading file....). Every time I try to do something I get a Permission denied: '/var/lib/ckan/storage/uploads/group' even if is an sysadmin user.

I tried giving full permissions to the /var/lib/ckan/storage but anything happens.

These are the permissions of the folder

And this is the error log:

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/app.py", line 2449, in wsgi_app
response = self.handle_exception(e)

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/app.py", line 1866, in handle_exception
reraise(exc_type, exc_value, tb)

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request
rv = self.handle_user_exception(e)

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception
reraise(exc_type, exc_value, tb)

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request
rv = self.dispatch_request()

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask_debugtoolbar/__init__.py", line 125, in dispatch_request
return view_func(**req.view_args)

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/views.py", line 89, in view
return self.dispatch_request(*args, **kwargs)

File "/usr/lib/ckan/venv/lib/python3.8/site-packages/flask/views.py", line 163, in dispatch_request
return meth(*args, **kwargs)

File "/usr/lib/ckan/venv/src/ckan/ckan/views/group.py", line 859, in post
group = _action(u'group_create')(context, data_dict)

File "/usr/lib/ckan/venv/src/ckan/ckan/logic/__init__.py", line 504, in wrapped
result = _action(context, data_dict, **kw)

File "/usr/lib/ckan/venv/src/ckan/ckan/logic/action/create.py", line 871, in group_create
return _group_or_org_create(context, data_dict)

File "/usr/lib/ckan/venv/src/ckan/ckan/logic/action/create.py", line 701, in _group_or_org_create
upload = uploader.get_uploader('group')

File "/usr/lib/ckan/venv/src/ckan/ckan/lib/uploader.py", line 60, in get_uploader
upload = Upload(upload_to, old_filename)

File "/usr/lib/ckan/venv/src/ckan/ckan/lib/uploader.py", line 126, in __init__
os.makedirs(self.storage_path)

File "/usr/lib/python3.8/os.py", line 223, in makedirs
mkdir(name, mode)

PermissionError: [Errno 13] Permission denied: '/var/lib/ckan/storage/uploads/group'

Thanx for any help.

Upvotes: 2

Views: 772

Answers (2)

WeSee
WeSee

Reputation: 3772

I had the same problem with a Docker instance of ckan.

Solution (do this in the ckan container as root user):

$ cd /var/lib/ckan
$ ls -l 
total 8
drwxr-xr-x    3 root     root          4096 Sep  7 17:17 storage
drwxr-xr-x    5 ckan     ckan          4096 Sep  7 17:18 webassets
$ chown -R ckan.ckan storage
$ ls -l
total 8
drwxr-xr-x    3 ckan     ckan          4096 Sep  7 17:17 storage
drwxr-xr-x    5 ckan     ckan          4096 Sep  7 17:18 webassets

Now CKAN works smoothly.

Upvotes: 0

dede
dede

Reputation: 198

If you're doing this as the 'ckan' user, I think you're getting this error because the storage folder is probably owned by 'root'. You should give folder owner to user 'ckan'.

Upvotes: 1

Related Questions