Configuring and Using Shared Storage in pgAdmin 4

May 31, 2023

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL. In this blog, I will walk you through how to configure and use shared storage in pgAdmin 4.

What is Shared Storage in pgAdmin 4?

The shared storage option of pgAdmin allows multiple users to use a common directory on the pgAdmin server host machine for the storage of files such as SQL scripts or backups. It can be set up by admin users. This feature is available for server mode only. Admin users have full control over actions like deleting, uploading, renaming the files, and creating new folders in the shared directory.

How to set up Shared Storage?

To use shared storage, an administrator user needs to configure the SHARED_STORAGE setting in the config file (for more details please check the config_local.py file). The shared storage configuration looks like the below.

SHARED_STORAGE = [{ 'name': Shared-Storage', 'path': '/var/pgadmin4/shared', 'restricted_access': True }, { 'name': Code-Shared', 'path': '/var/pgadmin4/shared_folder/', 'restricted_access': False }]
  1. name: Name to be displayed in pgAdmin file browser
  2. path: This is the absolute path of the shared directory on the host machine.
  3. restricted_access: If the user sets this to ‘True’, then shared storage will be read only for non admin users

Administrators can specify multiple shared storage areas with different access policies by passing them as a list of dictionaries containing specifications for each one.  Note: You must ensure the directories specified are writeable by the user that owns the web server process. e.g. apache or www-data.*

How to use Shared Storage?

Once an administrator completes the shared storage setup, other admin and non-admin users can use it. 

For example, if an administrator user wants to share a server configuration JSON file with all the pgAdmin users, the administrator can add that file into the shared storage.

The file can be added through the pgAdmin storage manager or directly copy the file to the shared directory.

Users can access shared storage from different navigation paths.

  1. Storage Manager:

    1. Open Tools menu -> Storage Managerstorage manager
    2. Click on the folder icon and it will open the dropdown.shared storage dropdown
    3. Here “Shared-Storage” and “Code-Shared” are shared storage areas and “My Storage” is user specific storage.
    4. You can easily switch between different storage areas by clicking on the name from the dropdown.
  2. Query Tool:

    1. You can access the shared storage areas from Query tool as well.
    2. Open Query Tool
    3. Select Open File from the toolbarquery-tool-window
    4. Now you can access shared storage from the drop down menu:
    5. shared-storage-dropdown

Conclusion

Using a shared storage administrator users can set up shared space that can be used by all other users for sharing files such as SQL scripts and backups. Admin users can also restrict the access to the shared storage to the non admin users.


 

Share this

More Blogs

Explaining ABI Breakage in PostgreSQL 17.1

PostgreSQL comes out with a scheduled major release every year and scheduled minor releases for all supported versions every quarter. But in the November minor releases, two issues caused the...
December 06, 2024

PGVector as Embedding Store in PrivateGPT

EDB has a long history of open source contributions, and while we’re best known for our contributions to Postgres, that’s not the only project we contribute to. e.g Barman, CloudNativePG...
June 05, 2024

pgAdmin User Management in Server Mode

pgAdmin can be deployed as a web application by configuring the app to run in server mode. One can check out server deployment on how to run pgAdmin in server...
August 24, 2023