Thread: PGAdmin Installed As Server Mode on Windows Apache Cannot DoBackup-Restore with Access Denied Message

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Regards,
Surya

Hi,

On Thu, May 7, 2020 at 6:04 AM Surya Widyanto <ayrus02@gmail.com> wrote:

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Have you changed any config settings related to PATH (DATA_DIR, SESSION_DB_PATH etc)?
On Windows, the DATA_DIR is set to %APPDATA%\pgAdmin by default.

Regards,
Surya

On 07-05-2020 11:01, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 6:04 AM Surya Widyanto <ayrus02@gmail.com> wrote:

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Have you changed any config settings related to PATH (DATA_DIR, SESSION_DB_PATH etc)?
On Windows, the DATA_DIR is set to %APPDATA%\pgAdmin by default.

Yes, I've already change the config_local.py file according to my server path. Below are my config_local.py file content:

SERVER_MODE = True

LOG_FILE = 'C:/WebApps/redacted/logs/pgadmin4.log'
SQLITE_PATH = 'C:/WebApps/
redacted/pgadmin4.db'
SESSION_DB_PATH = 'C:/WebApps/
redacted/sessions/'
STORAGE_DIR = 'C:/WebApps/
redacted/storage/'

MAIL_SERVER = '127.0.0.1'
MAIL_PORT = 25
MAIL_USE_SSL = False
MAIL_USE_TLS = False
MAIL_USERNAME = '
redacted'
MAIL_PASSWORD = '
redacted'
MAIL_DEBUG = False

BTW, on the link you gave above there is no mentioning about DATA_DIR variable on config file...?? Is there something I miss about the config?

For information, the LOG_FILE and SQLITE_PATH are working fine... I can see the log file and view the pgadmin4.db file and it's content.
The SESSION_DB_PATH and STORAGE_DIR are both I check exists and inside it some folder are created acording to the account and session logged in to PGAdmin4 Server Mode.

Regards,
Surya

Regards,
Surya


Hi,

On Thu, May 7, 2020 at 3:54 PM Surya Widyanto <ayrus02@gmail.com> wrote:
On 07-05-2020 11:01, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 6:04 AM Surya Widyanto <ayrus02@gmail.com> wrote:

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Have you changed any config settings related to PATH (DATA_DIR, SESSION_DB_PATH etc)?
On Windows, the DATA_DIR is set to %APPDATA%\pgAdmin by default.

Yes, I've already change the config_local.py file according to my server path. Below are my config_local.py file content:

SERVER_MODE = True

LOG_FILE = 'C:/WebApps/redacted/logs/pgadmin4.log'
SQLITE_PATH = 'C:/WebApps/
redacted/pgadmin4.db'
SESSION_DB_PATH = 'C:/WebApps/
redacted/sessions/'
STORAGE_DIR = 'C:/WebApps/
redacted/storage/'

MAIL_SERVER = '127.0.0.1'
MAIL_PORT = 25
MAIL_USE_SSL = False
MAIL_USE_TLS = False
MAIL_USERNAME = '
redacted'
MAIL_PASSWORD = '
redacted'
MAIL_DEBUG = False

BTW, on the link you gave above there is no mentioning about DATA_DIR variable on config file...?? Is there something I miss about the config?

For information, the LOG_FILE and SQLITE_PATH are working fine... I can see the log file and view the pgadmin4.db file and it's content.
The SESSION_DB_PATH and STORAGE_DIR are both I check exists and inside it some folder are created acording to the account and session logged in to PGAdmin4 Server Mode.

Please check the permission of the file/directory you have changed. It should be 0700.

Regards,
Surya

Regards,
Surya


On 07-05-2020 18:00, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 3:54 PM Surya Widyanto <ayrus02@gmail.com> wrote:
On 07-05-2020 11:01, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 6:04 AM Surya Widyanto <ayrus02@gmail.com> wrote:

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Have you changed any config settings related to PATH (DATA_DIR, SESSION_DB_PATH etc)?
On Windows, the DATA_DIR is set to %APPDATA%\pgAdmin by default.

Yes, I've already change the config_local.py file according to my server path. Below are my config_local.py file content:

SERVER_MODE = True

LOG_FILE = 'C:/WebApps/redacted/logs/pgadmin4.log'
SQLITE_PATH = 'C:/WebApps/
redacted/pgadmin4.db'
SESSION_DB_PATH = 'C:/WebApps/
redacted/sessions/'
STORAGE_DIR = 'C:/WebApps/
redacted/storage/'

MAIL_SERVER = '127.0.0.1'
MAIL_PORT = 25
MAIL_USE_SSL = False
MAIL_USE_TLS = False
MAIL_USERNAME = '
redacted'
MAIL_PASSWORD = '
redacted'
MAIL_DEBUG = False

BTW, on the link you gave above there is no mentioning about DATA_DIR variable on config file...?? Is there something I miss about the config?

For information, the LOG_FILE and SQLITE_PATH are working fine... I can see the log file and view the pgadmin4.db file and it's content.
The SESSION_DB_PATH and STORAGE_DIR are both I check exists and inside it some folder are created acording to the account and session logged in to PGAdmin4 Server Mode.

Please check the permission of the file/directory you have changed. It should be 0700.
How in Windows to set the file permission to 0700?

I've already set in Security Tabs of the folder/file properties to allow Everyone to have Full Control (read, write, list, modify, execute).


Regards,
Surya

Regards,
Surya



Attachment
Hi,

Here are more error logs after I activate the debug mode and debug level log:

2020-05-08 06:17:59,190: INFO    pgadmin:    Executing the process executor with the arguments: ['python', 'C:\\Program Files (x86)\\pgAdmin 4\\v4\\web\\pgadmin\\misc\\bgprocess\\process_executor.py', 'C:\\Program Files\\PostgreSQL\\12\\bin\\psql.exe', '--host', 'localhost', '--port', '5432', '--username', 'postgres', '--dbname', 'redacted', '--command', 'REFRESH MATERIALIZED VIEW CONCURRENTLY redactedschema.redactedmaterializedview WITH DATA;']
2020-05-08 06:17:59,206: ERROR    pgadmin:    [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\browser\server_groups\servers\databases\schemas\views\__init__.py", line 2155, in refresh_data
    p.start()
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\misc\bgprocess\processes.py", line 369, in start
    p = Popen(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified


And for the Access Denied when Backup/Restore Database, I cannot find any entry on the PGAdmin4.log file.

Regards,
Surya


On 07-05-2020 18:00, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 3:54 PM Surya Widyanto <ayrus02@gmail.com> wrote:
On 07-05-2020 11:01, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 6:04 AM Surya Widyanto <ayrus02@gmail.com> wrote:

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Have you changed any config settings related to PATH (DATA_DIR, SESSION_DB_PATH etc)?
On Windows, the DATA_DIR is set to %APPDATA%\pgAdmin by default.

Yes, I've already change the config_local.py file according to my server path. Below are my config_local.py file content:

SERVER_MODE = True

LOG_FILE = 'C:/WebApps/redacted/logs/pgadmin4.log'
SQLITE_PATH = 'C:/WebApps/
redacted/pgadmin4.db'
SESSION_DB_PATH = 'C:/WebApps/
redacted/sessions/'
STORAGE_DIR = 'C:/WebApps/
redacted/storage/'

MAIL_SERVER = '127.0.0.1'
MAIL_PORT = 25
MAIL_USE_SSL = False
MAIL_USE_TLS = False
MAIL_USERNAME = '
redacted'
MAIL_PASSWORD = '
redacted'
MAIL_DEBUG = False

BTW, on the link you gave above there is no mentioning about DATA_DIR variable on config file...?? Is there something I miss about the config?

For information, the LOG_FILE and SQLITE_PATH are working fine... I can see the log file and view the pgadmin4.db file and it's content.
The SESSION_DB_PATH and STORAGE_DIR are both I check exists and inside it some folder are created acording to the account and session logged in to PGAdmin4 Server Mode.

Please check the permission of the file/directory you have changed. It should be 0700.

Regards,
Surya

Regards,
Surya



Hi,

On Fri, May 8, 2020 at 5:16 AM Surya Widyanto <ayrus02@gmail.com> wrote:
Hi,

Here are more error logs after I activate the debug mode and debug level log:

2020-05-08 06:17:59,190: INFO    pgadmin:    Executing the process executor with the arguments: ['python', 'C:\\Program Files (x86)\\pgAdmin 4\\v4\\web\\pgadmin\\misc\\bgprocess\\process_executor.py', 'C:\\Program Files\\PostgreSQL\\12\\bin\\psql.exe', '--host', 'localhost', '--port', '5432', '--username', 'postgres', '--dbname', 'redacted', '--command', 'REFRESH MATERIALIZED VIEW CONCURRENTLY redactedschema.redactedmaterializedview WITH DATA;']
2020-05-08 06:17:59,206: ERROR    pgadmin:    [WinError 2] The system cannot find the file specified
Traceback (most recent call last):
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\browser\server_groups\servers\databases\schemas\views\__init__.py", line 2155, in refresh_data
    p.start()
  File "C:\Program Files (x86)\pgAdmin 4\v4\web\pgadmin\misc\bgprocess\processes.py", line 369, in start
    p = Popen(
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified


I think there might be some problem with the python executable path. Please log this issue @ https://redmine.postgresql.org/projects/pgadmin4 to investigate further. 
Also mention the pgAdmin 4 version from which you have upgraded to the latest.

Thanks,
Khushboo
And for the Access Denied when Backup/Restore Database, I cannot find any entry on the PGAdmin4.log file.

Regards,
Surya


On 07-05-2020 18:00, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 3:54 PM Surya Widyanto <ayrus02@gmail.com> wrote:
On 07-05-2020 11:01, Khushboo Vashi wrote:
Hi,

On Thu, May 7, 2020 at 6:04 AM Surya Widyanto <ayrus02@gmail.com> wrote:

Hi,

Recently I've successfully upgraded to PGAdmin v4.21 as Server Mode, but I had some problem when do Database Backup/Restore from PGAdmin.
When I try to browse the directory/folder to store my backup file, the PGAdmin4 give Access Denied message. I cannot view the directory content which I try to save the backup file.

Is there any config or setup file I missed to configure the directory permission on Windows?

Another problem is after I upgraded to v4.21, I cannot refresh my materialized view using the right click context menu with error
Failed to create materialized view refresh job. [WinError 2] The system cannot find the specified file

What can I do so I can refresh my materialized view except from running it manually in Query Editor?

FYI: I run the PGAdmin4 on Windows Server 2016 Standard (x64) and Apache/2.4.41 (Win64) mod_wsgi/4.7.1 Python/3.8

Have you changed any config settings related to PATH (DATA_DIR, SESSION_DB_PATH etc)?
On Windows, the DATA_DIR is set to %APPDATA%\pgAdmin by default.

Yes, I've already change the config_local.py file according to my server path. Below are my config_local.py file content:

SERVER_MODE = True

LOG_FILE = 'C:/WebApps/redacted/logs/pgadmin4.log'
SQLITE_PATH = 'C:/WebApps/
redacted/pgadmin4.db'
SESSION_DB_PATH = 'C:/WebApps/
redacted/sessions/'
STORAGE_DIR = 'C:/WebApps/
redacted/storage/'

MAIL_SERVER = '127.0.0.1'
MAIL_PORT = 25
MAIL_USE_SSL = False
MAIL_USE_TLS = False
MAIL_USERNAME = '
redacted'
MAIL_PASSWORD = '
redacted'
MAIL_DEBUG = False

BTW, on the link you gave above there is no mentioning about DATA_DIR variable on config file...?? Is there something I miss about the config?

For information, the LOG_FILE and SQLITE_PATH are working fine... I can see the log file and view the pgadmin4.db file and it's content.
The SESSION_DB_PATH and STORAGE_DIR are both I check exists and inside it some folder are created acording to the account and session logged in to PGAdmin4 Server Mode.

Please check the permission of the file/directory you have changed. It should be 0700.

Regards,
Surya

Regards,
Surya