question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OSError at /auth/after/ - [Errno 13] Permission denied: '.cache' (Ubuntu Server 2017.04)

See original GitHub issue

Hi!

I am trying to deploy the app in production but I am getting the follow error after I try to login with google credential (when google return to my page after successfully login):

Environment:


Request Method: GET
Request URL: http://e-vote.sorocaba.sp.gov.br/auth/after/?code=4/wrvcK1FReCoZOm-WZtT9EGzYur7qakoLF0VKoExYljM

Django Version: 1.8.18
Python Version: 2.7.13
Installed Applications:
('djangosecure',
 'django.contrib.sessions',
 'djcelery',
 'kombu.transport.django',
 'helios_auth',
 'helios',
 'server_ui')
Installed Middleware:
('djangosecure.middleware.SecurityMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/var/www/helios/helios_auth/views.py" in after
  185.   user = system.get_user_info_after_auth(request)
File "/var/www/helios/helios_auth/auth_systems/google.py" in get_user_info_after_auth
  51.   http = httplib2.Http(".cache")
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py" in __init__
  1239.             self.cache = FileCache(cache)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py" in __init__
  726.             os.makedirs(self.cache)
File "/usr/lib/python2.7/os.py" in makedirs
  157.     mkdir(name, mode)

Exception Type: OSError at /auth/after/
Exception Value: [Errno 13] Permission denied: '.cache'

I tried to use brutal force (besides knowing that isn’t the best solution) changing the directory’s permission where I deployed the app (chmod 777 -R /var/www/helios) but I still got this very same error.

The real question is: where is the caching folder that permission is denied?

My http.conf:

<VirtualHost *:80>
    ServerName e-vote.sorocaba.sp.gov.br
    ServerAdmin jecampos@sorocaba.sp.gov.br
    DocumentRoot /var/www/helios
#   DocumentRoot /usr/local/apache2/htdocs
#   Redirect / https://e-vote.sorocaba.sp.gov.br/

    WSGIScriptAlias / /var/www/helios/wsgi.py
    WSGIDaemonProcess   e-vote python-path=/var/www/helios/:/usr/local/lib/python2.7/dist-packages
    WSGIProcessGroup    e-vote

    Alias /booth /var/www/helios/sitestatic/booth
    Alias /verifier /var/www/helios/sitestatic/verifier

    Alias /media /var/www/helios/sitestatic
    <Directory /var/www/helios/sitestatic>
        Require all granted
    </Directory>

    <Directory /var/www/helios>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>

    LogLevel warn

    ErrorLog ${APACHE_LOG_DIR}/e-vote_error.log
    CustomLog ${APACHE_LOG_DIR}/e-vote_access.log combined
</VirtualHost>

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
benadidacommented, Feb 4, 2018

this looks to be a Django + web server permissions configuration issue, not specific to Helios. Closing this, please reopen if you think there’s something specific about Helios that is causing this.

0reactions
foguinhoperucacommented, Mar 30, 2018

@rdenadai I was using Ubuntu Server 2017.10.

@shirlei I’ve tried to chmod 777 -R /var/www/helios and it didn’t worked. Just the little hack above worked.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - OSError - Errno 13 Permission denied - Stack Overflow
You need to change the directory permission so that web server process can change the directory. To change ownership of the directory, use...
Read more >
OSError: [Errno 13] Permission denied: '/var/tmp/yum-njd-LrUZic'
Bug 689161 - OSError: [Errno 13] Permission denied: '/var/tmp/yum-njd-LrUZic' ... line 589, in getCacheDir cachedir = tempfile.mkdtemp(prefix=prefix, ...
Read more >
Installation Error - SENAITE Community
Hi there, I am trying to Setup Senaite on Ubuntu 18.04 as recommended by the installation guide ...
Read more >
2 - Ask Ubuntu
OSError : [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pelican-3.6.3.dist-info' [duplicate] · 14.04 · python · pelican.
Read more >
Python PermissionError: [errno 13] permission denied Solution
If you are running a Python script from a web server process, for instance, you would need to make sure that the user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found