pythonckan

Error when trying to setting up the CKAN filestore with local storage: Permission Denied


I set up the local file storage according to these steps

http://docs.ckan.org/en/latest/filestore.html

  1. Create location

    sudo mkdir -p /var/lib/ckan/default 
    

    I confirm the location exists and is in the right location

  2. I uncomment the lines

    ofs.impl = pairtree
    ofs.storage_dir = /var/lib/ckan/default
    

    I confirmed I have pairtree and argparse installed

  3. I am using jetty as the web server not Apache so I do

    sudo chown jetty /var/lib/ckan/default
    sudo chmod u+rwx /var/lib/ckan/default
    sudo service jetty restart
    
  4. Then I run this command to start my site

    paster serve /etc/ckan/default/development.ini
    

I then get this stack trace back, I am doing all of these commands inside my virtual environment

2013-12-04 17:39:46,369 WARNI [ckan.lib.uploader] Please use config option ckan.storage_path instaed of
                     ofs.storage_path
Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
    load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
    result = self.command()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 321, in loadapp
    **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/util.py", line 56, in fix_call
    val = callable(*args, **kw)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 156, in make_app
    os.makedirs(path)
  File "/usr/lib/ckan/default/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/lib/ckan/default/storage'

Solution

  • Permission denied: '/var/lib/ckan/default/storage'

    It looks like you don't have permission to read and write to this directory. Try running these commands in a terminal:

    sudo chown -R `whoami` /var/lib/ckan/default
    sudo chmod -R u+rwx /var/lib/ckan/default