Overview
Shared servers allow the admin user to share servers with other users so that they can use them directly without adding them themselves.
Shared servers only apply when pgAdmin is running in server mode. Server mode is a multi-user mode whereas Desktop mode is single user mode. In server mode users must login before they can use pgAdmin. An initial superuser account is created when server mode is initialised, and this user can add additional superusers and non-superusers as required.
How to share a server in pgAdmin 4
To share a server, you need to have admin privileges in pgAdmin. Once you are logged in as an admin, then you can share a server while creating a new one or you can also share an existing server. Admin users can share the server by enabling the "Shared?" option.
Please note that once the server is shared, the server icon will change in the browser tree.
This option is only visible to admin users; non-admin users won't be able to share the server with others. It is only available in server mode.
Once the server is shared, users who are not the owner of the server will see the shared server in the respective server group. The entire server group will be shared if it has one shared server in it but only shared servers in that server group will be visible to other users.
Connect to a shared server
To connect to the shared server, a user who is not the owner of the server needs to enter a username. The "Properties" dialog will open if the user clicks on a shared server for the very first time and then the user needs to enter the username and password to connect to the server.
Who shared the server?
Users can see the shared server owner in the properties panel. This field is only visible to users other than the owner of the server.
Restrictions for non-admin users
Non-admin users can access the shared servers with some restrictions - the following operations on shared servers are not permitted:
- Delete the server
- Rename the server
- Rename the server group
- Change of host, port, and maintenance database
Hiding a shared server
If the user doesn't want to see shared servers then at any time they can hide them all by changing the preferences setting:
Conclusion
Shared servers are useful to avoid the repetitive process of adding the same server for each user. Once the server is shared by an admin user then it will be visible to all users unless they have chosen to hide them.