OSError: [Errno 13] Permission denied: '/var/lib/pgadmin'

Permission error means the user 'michael' (/var/lib has drwxr-xr-x) has the permission to execute but doesn't have the permission to write on the folder (according to your comment of the folder info below). One of the solutions you can use to be able to access freely the folder would be something like:

chown -R michael:root /path/to/the/directory

The second part of the answer, you've figured it out @Michael. downloading pgadmin by using the command:

wget https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v1.5/pip/pgadmin4-1.5-py2.py3-none-any.whl 

and then execute command:

pip install pgadmin4*.whl.

If you do not want to change the permission of anything, you can always override default paths in pgAdmin4.

Create a file named config_local.py (if not already present) at your installation location ../pgadmin4/web/

File location in my case: /usr/local/lib/python2.7/dist-packages/pgadmin4/config_local.py

and add following code in your config_local.py,

import os
DATA_DIR = os.path.realpath(os.path.expanduser(u'~/.pgadmin/'))
LOG_FILE = os.path.join(DATA_DIR, 'pgadmin4.log')
SQLITE_PATH = os.path.join(DATA_DIR, 'pgadmin4.db')
SESSION_DB_PATH = os.path.join(DATA_DIR, 'sessions') 
STORAGE_DIR = os.path.join(DATA_DIR, 'storage')

Restart pgAdmin4 and check.


create the folders manually (or add to your pgAdmin installation script, if there is one), and assign the permissions:

sudo mkdir "/var/log/pgadmin"
sudo chmod a+wrx "/var/log/pgadmin"

sudo mkdir "/var/lib/pgadmin"
sudo chmod a+wrx "/var/lib/pgadmin"

this would not assign permissions to the entire /var/log but just for the /var/log/pgadmin only.

Tags:

Pgadmin 4