分類: IT綜合技術
一、問題描述與分析
部署完WEBLOGIC后,在每次啟動時執行./startWebLogic.sh腳本時,都會停在輸入用戶名與密碼這里,相當不方便。所以要做到啟動過程不輸入密碼有兩種做法,見下面實例。
二、實驗過程
A. 修改WebLogic的啟動腳本,即修改startWebLogic.sh,增加用戶名(weblogic)與密碼(password),步驟如下:
1. 進入WLS_HOME/bin目錄
[wls06@wls bin]$ pwd
/home/wls06/base_domain/bin
2. 在startWebLogic.sh執行腳本中加入用戶名與密碼,並保存退出
[wls06@wls bin]$ vi startWebLogic.sh
WLS_USER="weblogic"
export WLS_USER
WLS_PW="password"
export WLS_PW
3. 重新啟動WebLogic服務
[wls06@wls bin]$ ./startWebLogic.sh &
B. 將用戶名和密碼保存到/home/wls06/base_domain/servers/AdminServer/security/boot.properties文件中,security文件夾需要新建,步驟如下:
1. 進入WLS_HOME/base_domain/servers/AdminServer目錄
[wls06@wls security]$ cd /home/wls06/base_domain/servers/AdminServer
[wls06@wls security]$ pwd
/home/wls06/base_domain/servers/AdminServer
2. 創建security目錄,並進入
[wls06@wls security]$ mkdir security
[wls06@wls security]$ cd security
3. 創建boot.properties文件編輯后保存退出
[wls06@wls security]$ vi boot.properties
username=weblogic
password=password
4. 重新啟動WebLogic服務(此處忽略停WebLogic服務)
[wls06@wls bin]$ ./startWebLogic.sh &
啟動過程中日志:
<Sep 23, 2015 4:10:58 PM CST> <Notice> <Security> <BEA-090083> <Storing boot identity in the file: /home/wls02/base_domain/base_domain/servers/AdminServer/security/boot.properties>
<Sep 23, 2015 4:11:43 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<Sep 23, 2015 4:11:43 PM CST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
5. 再次檢查boot.properties文件,發現用戶名與密碼已經做過加密處理
[wls02@test1 security]$ cat boot.properties
#Wed Sep 23 16:10:59 CST 2015
password={AES}Fl/BKG+a166kZkR/m7gOL+hMhPF9JACWZLvxo5fFC4c\=
username={AES}e/zSyaDEsl6eBx0tVIBj7ISnhcN1wu3nw1dLPLBC2qA\=
三、總結
Weblogic在安裝部署后,每次啟動輸入密碼的做法很少見,使用上述兩種方法可以解決,通常會選用第二種做法boot.properties文件 ,並且重啟動一次后,密碼變為密文,這樣更加安全可靠。