Stopping portal and WAS using command line includes user id and password as part of command. Below command holds good when security is enabled.
stopServer.sh server1 -username wasadmin -password wasadmin
This would cause a security issue as while typing command, anyone can see and come to know about userid and password.
To overcome this kind of security breach, please follow below steps which would allow you to stop portal and WAS without providing user id and password in the command line.
1) Find the file soap.client.props located under /WebSphere/AppServer/profiles/AppSrv01/properties and change the values of userid and password for the following properties
the userid and password, will be the WAS admin'S userid and password.
2) Now that you are done with writing userid and password in the file. You can now run the command without specifying userid and password in the command line BUT still we have got security issue, because whoever knows path of this file, could see the userid and password in the file.
To overcome this, we need to obfuscate the password property in the soap.client.props file. We can use PropFilePasswordEncoder.sh command to obfuscate password propery.
Use the below command to achieve this
./PropFilePasswordEncoder.sh /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/properties/soap.client.props com.ibm.SOAP.loginPassword
Now, if you open the file in a text editor, you will find that password property is now obfuscated.
3) Restart he portal server.
Now onwards, you won't need to specify userid and password in the command line for stopping Portal and WAS.