[Geoserver-users] Unable to find the .shp file when I'm trying to add a new store

Hello,

I’m trying to publish a shapefile in my geoserver. I have created the geoserver_data directory and I have inserted a shapefile folder in it. When I’m browsing on the Shapefile location field to find the .shp file and I’m opening the shapefile folder, it is empty. I can’t find the shp file via geoserver while the folder contains all the appropriate files.

What can I do to solve this ?

Thank you in advance !

Gi,

is your GeoServer is running on Linux? Does the system GeoServer user (e.g. tomcat) have permission to list the directory contents? If not, GeoServer will let you browse the folder but it will appear to be empty. This is a common problem that occurs when adding data as the root user when your servlet container is running as a non-root user, because the default permissions for new files created by root are often restrictive. You can examine the permissions on this directory and its contents with:

ls -al your_shapefile_directory

You can grant read access to group and other users with (as a permissive example):

chmod -R go+rX your_shapefile_directory

The X (execute bit where set for some user) permits directory contents to be listed and must be set to permit on directories to allow browsing of their contents. All parent directories up to "/" require read and execute permissions as well.

An alternate solution is to use chown to change the owner and group of the new data to match your other data directory files. For example, if and only if your data directory is owned by a user called "tomcat" with a group called "tomcat" (check before you do this as there is no way to recover the owner/group information after you change it):

chown -R tomcat:tomcat your_shapefile_directory

or even to set this for your entire data directory:

chown -R tomcat:tomcat your_geoserver_data_directory

The best solution depends on your system conventions and configuration.

If this does not work, are you running selinux with enforcing? You can list your security contexts with:

ls -alZ your_shapefile_directory

If you are using selinux enforcing you may need to use restorecon after adding new data. This depends on your system configuration. If you do not see security contexts when running "ls -alZ" and only see "?" then you are likely not running selinux.

Kind regards,
Ben.

On 03/01/16 09:09, Gi Petrak wrote:

Hello,

I'm trying to publish a shapefile in my geoserver. I have created the
geoserver_data directory and I have inserted a shapefile folder in it. When
I'm browsing on the Shapefile location field to find the .shp file and I'm
opening the shapefile folder, it is empty. I can't find the shp file via
geoserver while the folder contains all the appropriate files.
What can I do to solve this ?

Thank you in advance !

------------------------------------------------------------------------------

_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/&gt;
New Zealand

Thank you very much !

I’m running Linux. Changing the permissions of my shapefile folder, problem solved. I used the first recommended solution.

Kind regards,

George

···

2016-01-02 23:25 GMT+02:00 Ben Caradoc-Davies <ben@anonymised.com>:

Gi,

is your GeoServer is running on Linux? Does the system GeoServer user (e.g. tomcat) have permission to list the directory contents? If not, GeoServer will let you browse the folder but it will appear to be empty. This is a common problem that occurs when adding data as the root user when your servlet container is running as a non-root user, because the default permissions for new files created by root are often restrictive. You can examine the permissions on this directory and its contents with:

ls -al your_shapefile_directory

You can grant read access to group and other users with (as a permissive example):

chmod -R go+rX your_shapefile_directory

The X (execute bit where set for some user) permits directory contents to be listed and must be set to permit on directories to allow browsing of their contents. All parent directories up to “/” require read and execute permissions as well.

An alternate solution is to use chown to change the owner and group of the new data to match your other data directory files. For example, if and only if your data directory is owned by a user called “tomcat” with a group called “tomcat” (check before you do this as there is no way to recover the owner/group information after you change it):

chown -R tomcat:tomcat your_shapefile_directory

or even to set this for your entire data directory:

chown -R tomcat:tomcat your_geoserver_data_directory

The best solution depends on your system conventions and configuration.

If this does not work, are you running selinux with enforcing? You can list your security contexts with:

ls -alZ your_shapefile_directory

If you are using selinux enforcing you may need to use restorecon after adding new data. This depends on your system configuration. If you do not see security contexts when running “ls -alZ” and only see “?” then you are likely not running selinux.

Kind regards,
Ben.

On 03/01/16 09:09, Gi Petrak wrote:

Hello,

I’m trying to publish a shapefile in my geoserver. I have created the
geoserver_data directory and I have inserted a shapefile folder in it. When
I’m browsing on the Shapefile location field to find the .shp file and I’m
opening the shapefile folder, it is empty. I can’t find the shp file via
geoserver while the folder contains all the appropriate files.
What can I do to solve this ?

Thank you in advance !



Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users


Ben Caradoc-Davies <ben@anonymised.com>
Director
Transient Software Limited <http://transient.nz/>
New Zealand