<a href="http://www.java2class.net/bbs/viewthread.php?tid=207" target="_blank">停止启用了安全性的was server而不手动输入密码之第二种选择</a>
众所周知的应当是如下最简单的方式了
%profile_home%/bin/stopserver.bat serverxyz -username xyz -password xyz
但是用户名与密码全是明文了,在某些场景下可能不太符合
现在给出第二种选择方法
set profile_home=d:/ibm/websphere/appserver/6.1/profiles/appsrvsingle
cd %profile_home%/properties
先备份一下 sas.client.props 与 soap.client.props 文件
由于连接的方式有两种 : soap 与 rmi,默认是 soap 方式
1. soap 方式的修改
打开 soap.client.props 文件,约在第 26 行
com.ibm.soap.loginuserid=
com.ibm.soap.loginpassword=
默认下,值均为空的,填入目前正在使用的用户与密码,比如均为websphere
com.ibm.soap.loginuserid=websphere
com.ibm.soap.loginpassword=websphere
然后执行
%profile_home%/bin/propfilepasswordencoder.bat %profile_home%/properties/soap.client.props com.ibm.soap.loginpassword -backup
执行成功后,会有如下提示
note: all specified passwords already encoded in target file == %profile_home%/properties/soap.client.props
或
note: backup file %profile_home%/properties/soap.client.props.bak contains unencoded passwords
打开 soap.client.props 文件可以看到密码已经加密,如下
com.ibm.soap.loginpassword={xor}cdo9dc83oi06
然后停止was server直接采用如下命令停止was server即可,不需要再输入用户名与密码了
%profile_home%/bin/stopserver.bat server1
%profile_home%/bin/stopserver.bat server1 -conntype soap
默认的soap连接端口是 soap_connector_address 端口
2. rmi 方式的修改与 soap 方式类同
打开 sas.client.props 文件,约在第 90 行
com.ibm.corba.loginuserid=
com.ibm.corba.loginpassword=
com.ibm.corba.loginuserid=websphere
com.ibm.corba.loginpassword=websphere
%profile_home%/bin/propfilepasswordencoder.bat %profile_home%/properties/sas.client.props com.ibm.corba.loginpassword -backup
note: all specified passwords already encoded in target file == %profile_home%/properties/sas.client.props
note: backup file %profile_home%/properties/sas.client.props.bak contains unencoded passwords
com.ibm.corba.loginpassword={xor}cdo9dc83oi06
需要注意的是 rmi 方式还需要更改如下键值
com.ibm.corba.loginsource=prompt
为
com.ibm.corba.loginsource=properties
%profile_home%/bin/stopserver.bat server1 -conntype rmi -port 2809
默认的rmi连接端口是 bootstrap_address 端口