首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在安装时以编程方式在Geoserver上设置用户名和密码

如何在安装时以编程方式在Geoserver上设置用户名和密码
EN

Stack Overflow用户
提问于 2013-01-31 13:41:51
回答 1查看 1.7K关注 0票数 4

我正在编写一个bash脚本,按照Install Instructions中列出的步骤安装Geoserver。我正在尝试使用CURL发布一个自定义的数据存储配置文件。但是我遇到了一个身份验证错误。

代码语言:javascript
复制
    * upload completely sent off: 42out of 42 bytes
    < HTTP/1.1 401 Unauthorized
    < Server: Apache-Coyote/1.1
    < Set-Cookie: SPRING_SECURITY_REMEMBER_ME_COOKIE=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/geoserver
    * Authentication problem. Ignoring this.
    < WWW-Authenticate: Basic realm="GeoServer Realm"
    < Content-Type: text/html;charset=utf-8
    < Content-Length: 1299
    < Date: Thu, 31 Jan 2013 05:16:17 GMT

我相信这是因为我还没有设置Geoserver的用户名和密码。我唯一能找到的方法就是通过网络管理界面来实现。我想通过我的bash脚本设置它。

有没有办法做到这一点?

此处的Bash脚本部分

代码语言:javascript
复制
    echo 'Downdloading geoserver'
    wget http://downloads.sourceforge.net/project/geoserver/GeoServer/2.2.4/geoserver-2.2.4-war.zip

    unzip geoserver-2.2.4-war.zip
    sudo cp geoserver.war /var/lib/tomcat7/webapps/

    sleep 120

    echo 'setting up geoserver'

    curl -u $U_NAME:$PASSWORD -v -XPOST -H 'Content-type: text/xml' \
       -d '<workspace><name>catami</name></workspace>' \
       http://localhost:8080/geoserver/rest/workspaces ;

    curl -u $U_NAME:$PASSWORD -XPOST -T datastore-config.xml -H 'Content-type: text/xml' \
      http://localhost:8080/geoserver/rest/workspaces/catami/datastores ;

    curl -u $U_NAME:$PASSWORD -XPOST -H 'Content-type: text/xml' \
      -d '<featureType><name>Force_image</name></featureType>' \
      http://localhost:8080/geoserver/rest/workspaces/catami/datastores/CatamiImagePoints/featuretypes ;

    curl -u $U_NAME:$PASSWORD -XPOST -H 'Content-type: application/vnd.ogc.sld+xml' \
      -d @catami-colour-by-depth.sld http://localhost:8080/geoserver/rest/styles ;

    curl -u $U_NAME:$PASSWORD -XPUT -H 'Content-type: text/xml' \
      -d '<layer><defaultStyle><name>catami-colour-by-depth</name></defaultStyle><enabled>true</enabled></layer>' \
      http://localhost:8080/geoserver/rest/layers/catami:Force_image
EN

回答 1

Stack Overflow用户

发布于 2013-01-31 14:15:22

显然,您可以在GeoServer数据目录中编辑用户名和密码。你可以阅读更多关于它的here

在找到要更改的文件之后,您只需根据自己的喜好对数据执行sed操作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14619238

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档