Change the User of the QuerySurge Service in Linux
QuerySurge is often installed as a service under the user "root". You may need QuerySurge to run under a different user. Following is the process to change the user in a Linux environment.
Note: A prerequisite for this procedure is the availability of a system user with the appropriate permissions for QuerySurge to run under for all QuerySurge directories and across servers in a multi-machine environment. For this article, we'll call the user "querysurgeuser" but you can name it according to your own convention.
- Make sure all users are out of the system and that no executions are running.
- Log into each QuerySurge deployment box with administrative privileges.
- Stop all of the QuerySurge services in the correct order using the [sudo] service QuerySurge stop command. (See this article for details: Stopping and Starting QuerySurge Services.)
- Change ownership of the /<QuerySurge Install Dir>/mysql/data directory to the new user.
chown -R querysurgeuser /<QuerySurge Install Dir>/QuerySurge/mysql/data
chown -R querysurgeuser /<QuerySurge Install Dir>/QuerySurge/mysql/tmpNote: The default installation directory is /opt/QuerySurge/.
- Make a backup copy of the file: /<QuerySurge Install Dir>/querysurge.sh
- Open the file for editing: /<QuerySurge Install Dir>/querysurge.sh using a text editor.
- Find the section that starts with: if [ "x$1" = "xhelp" ] || [ "x$1" = "x" ]; then
- Modify the two sections that refer to MySQL to add: su <new user> to the start call.
- Save the changes.
- If the Application Server is on another machine, repeat steps 5 - 9 on that server, modifying the script in the same place. Modify permissions on the tomcat process:
chown -R querysurgeuser /<QuerySurge Install Dir>/QuerySurge/tomcat
- If the Agent is on another machine, repeat steps 5 - 9 on that server, modifying the script in the same place. Modify permissions on the agent server:
chown -R querysurgeuser /<QuerySurge Install Dir>/QuerySurge/agent
- Start all QuerySurge services in the correct order per the linked article above using the command: [sudo] service QuerySurge start.
- Verify services are running as the chosen user with: ps -au
- Open QuerySurge in a browser, log in and verify normal behavior.