[GH-ISSUE #278] Permission Denied .secret_key_store #220

Closed
opened 2026-02-27 16:38:28 +03:00 by kerem · 2 comments
Owner

Originally created by @EmbeddedAndroid on GitHub (Apr 11, 2014).
Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/278

I just deployed the HEAD of master onto my server and am getting this error:

WARNING:root:No local_settings file found.
Traceback (most recent call last):
File "/var/www/webvirtmgr/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/usr/local/lib/python2.7/dist-packages/django/core/management/init.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/dist-packages/django/conf/init.py", line 53, in getattr
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/init.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/init.py", line 132, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
import(name)
File "/var/www/webvirtmgr/webvirtmgr/settings.py", line 194, in
'.secret_key_store'))
File "/var/www/webvirtmgr/webvirtmgr/utils/secret_key.py", line 56, in generate_or_read_from_file
with open(key_file, 'w') as f:
IOError: [Errno 13] Permission denied: '/var/www/webvirtmgr/webvirtmgr/local/.secret_key_store'
tyler@virt-manager:/etc/supervisor/conf.d$ cd /var/www/webvirtmgr/webvirtmgr/local/
tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr/local$ ls
init.py local_settings.py.example
tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr/local$ ls -al
total 12
drwxr-xr-x 2 root root 4096 Apr 11 12:54 .
drwxrwxr-x 5 www-data www-data 4096 Apr 11 12:56 ..
-rw-r--r-- 1 root root 0 Apr 11 12:54 init.py
-rw-r--r-- 1 root root 3800 Apr 11 12:54 local_settings.py.example
tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr/local$ cd ..
tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr$ ls -al
total 60
drwxrwxr-x 5 www-data www-data 4096 Apr 11 12:56 .
drwxr-xr-x 18 www-data www-data 4096 Apr 11 12:54 ..
-rw-rw-r-- 1 www-data www-data 0 Jan 29 21:30 init.py
-rw-rw-r-- 1 www-data www-data 132 Jan 29 21:30 init.pyc
drwxr-xr-x 2 root root 4096 Apr 11 12:54 local
-rw-r--r-- 1 root root 5542 Apr 11 12:54 settings_jenkins.py
-rw-r--r-- 1 root root 7071 Apr 11 12:54 settings.py
-rw-r--r-- 1 www-data www-data 3975 Apr 11 12:56 settings.pyc
drwxr-xr-x 6 root root 4096 Apr 11 12:54 static
-rw-r--r-- 1 root root 1625 Mar 9 04:49 urls.py
-rw-r--r-- 1 www-data www-data 1966 Mar 9 04:51 urls.pyc
drwxr-xr-x 2 root root 4096 Apr 11 12:54 utils
-rw-rw-r-- 1 www-data www-data 1431 Jan 29 21:30 wsgi.py
-rw-r--r-- 1 www-data www-data 1031 Jan 29 21:41 wsgi.pyc
tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr$

What permissions would be correct for this directory?

Originally created by @EmbeddedAndroid on GitHub (Apr 11, 2014). Original GitHub issue: https://github.com/retspen/webvirtmgr/issues/278 I just deployed the HEAD of master onto my server and am getting this error: WARNING:root:No local_settings file found. Traceback (most recent call last): File "/var/www/webvirtmgr/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/**init**.py", line 453, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/dist-packages/django/core/management/**init**.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python2.7/dist-packages/django/core/management/**init**.py", line 263, in fetch_command app_name = get_commands()[subcommand] File "/usr/local/lib/python2.7/dist-packages/django/core/management/**init**.py", line 109, in get_commands apps = settings.INSTALLED_APPS File "/usr/local/lib/python2.7/dist-packages/django/conf/**init**.py", line 53, in **getattr** self._setup(name) File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in _setup self._wrapped = Settings(settings_module) File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in **init** mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module **import**(name) File "/var/www/webvirtmgr/webvirtmgr/settings.py", line 194, in <module> '.secret_key_store')) File "/var/www/webvirtmgr/webvirtmgr/utils/secret_key.py", line 56, in generate_or_read_from_file with open(key_file, 'w') as f: IOError: [Errno 13] Permission denied: '/var/www/webvirtmgr/webvirtmgr/local/.secret_key_store' tyler@virt-manager:/etc/supervisor/conf.d$ cd /var/www/webvirtmgr/webvirtmgr/local/ tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr/local$ ls **init**.py local_settings.py.example tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr/local$ ls -al total 12 drwxr-xr-x 2 root root 4096 Apr 11 12:54 . drwxrwxr-x 5 www-data www-data 4096 Apr 11 12:56 .. -rw-r--r-- 1 root root 0 Apr 11 12:54 **init**.py -rw-r--r-- 1 root root 3800 Apr 11 12:54 local_settings.py.example tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr/local$ cd .. tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr$ ls -al total 60 drwxrwxr-x 5 www-data www-data 4096 Apr 11 12:56 . drwxr-xr-x 18 www-data www-data 4096 Apr 11 12:54 .. -rw-rw-r-- 1 www-data www-data 0 Jan 29 21:30 **init**.py -rw-rw-r-- 1 www-data www-data 132 Jan 29 21:30 **init**.pyc drwxr-xr-x 2 root root 4096 Apr 11 12:54 local -rw-r--r-- 1 root root 5542 Apr 11 12:54 settings_jenkins.py -rw-r--r-- 1 root root 7071 Apr 11 12:54 settings.py -rw-r--r-- 1 www-data www-data 3975 Apr 11 12:56 settings.pyc drwxr-xr-x 6 root root 4096 Apr 11 12:54 static -rw-r--r-- 1 root root 1625 Mar 9 04:49 urls.py -rw-r--r-- 1 www-data www-data 1966 Mar 9 04:51 urls.pyc drwxr-xr-x 2 root root 4096 Apr 11 12:54 utils -rw-rw-r-- 1 www-data www-data 1431 Jan 29 21:30 wsgi.py -rw-r--r-- 1 www-data www-data 1031 Jan 29 21:41 wsgi.pyc tyler@virt-manager:/var/www/webvirtmgr/webvirtmgr$ What permissions would be correct for this directory?
kerem closed this issue 2026-02-27 16:38:28 +03:00
Author
Owner

@schmitch commented on GitHub (Apr 11, 2014):

755 is fine, but when you call manage.py with www-data local needs to have the user www-data like
chown www-data.www-data -R /var/www/webvirtmgr/local

Currently this is not an error or issue you should create, since its related to your server.
i mean you are logged in with tyler, on a directory which is owned by root and / or www-data, you definitly need to fix it or assign chmod 777 to local. but that is not a good solution since you publickey will be in the .secret_key_store file, which will get created for you.

<!-- gh-comment-id:40252522 --> @schmitch commented on GitHub (Apr 11, 2014): 755 is fine, but when you call manage.py with www-data local needs to have the user www-data like `chown www-data.www-data -R /var/www/webvirtmgr/local` Currently this is not an error or issue you should create, since its related to your server. i mean you are logged in with tyler, on a directory which is owned by root and / or www-data, you definitly need to fix it or assign chmod 777 to local. but that is not a good solution since you publickey will be in the .secret_key_store file, which will get created for you.
Author
Owner

@EmbeddedAndroid commented on GitHub (Apr 11, 2014):

Thanks that worked perfectly.

<!-- gh-comment-id:40252900 --> @EmbeddedAndroid commented on GitHub (Apr 11, 2014): Thanks that worked perfectly.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/webvirtmgr#220
No description provided.