Change Ownership to Non-Root User

Starting October 11, 2024 (Zephyr Enterprise 8.2), the Zephyr Enterprise documentation moved from its current location on Atlassian to a dedicated, standalone Zephyr Enterprise documentation page. Please see: https://support.smartbear.com/zephyr-enterprise/docs/en/zephyr-enterprise/zephyr-installation---upgrade-guides/upgrade-zephyr-enterprise/zephyr-on-premise-upgrade-instructions/change-ownership-to-non-root-user.html

The topic provides detailed instructions for migrating a Zephyr instance that is currently installed or managed by a root user, to a non-root user.

The migration process involves transferring ownership of the Zephyr installation, Zephyr attachment files, and Zephyr managed services to the designated non-root user. Additionally, this topic outlines the creation of a non-root user if one does not already exist.

Prerequisites for Migration

Before proceeding with the migration, ensure that the following prerequisites are met:

  • A Zephyr instance is installed and operated by a root user.

  • Administrative access to the system.

  • A non-root user account that will serve as the new owner of the Zephyr instance.

We are using zephyr as a non-root user as an example. This user will not be created as part of Zephyr. You need to create the user separately.

Migration Steps

Following are the steps to migrate a Zephyr instance from root user to non-root user:

  1. Stop Zephyr.

  2. Follow the commands and steps listed below.

  3. Start Zephyr as a non-root user.

As mentioned in the step #2, follow the steps, changes and their required commands given below:

a. Migrating Zephyr installation

Run the following command to change ownership of the Zephyr installation:

sudo chown -R <non-root_user> <ZEPHYR_HOME>

Example:

sudo chown -R zephyr /opt/zephyr

b. Migrating Zephyr attachment files

If ZEPHYR_DATA or NODE_DATA folders are components of ZEPHYR_HOME, then you can skip those relevant commands.

  • Run the following command to change ownership of the ZEPHYR_DATA folder:

sudo chown -R <non-root_user> <ZEPHYR_DATA>

Example:

  • Run the following command to change ownership of the NODE_DATA folder:

Example:

c. Migrating Zephyr Services

  • Run the following command to change the ownership of the symlink of ZephyrService.sh:

Example:

  • Change the user in the ZephyrService.sh file using the following steps:

  • Open the file <ZEPHYR_HOME>/bin/ZephyrService.sh. Ex: /opt/zephyr/bin/ZephyrService.sh.

  • Locate the following line:

    Change the above line to:

    Example:

  • Save the file.

  • You need to change the user in the system unit file using the following steps:

  1. Login as a root user.

  2. Locate the unit file here: /etc/systemd/system/ZephyrService.service.

  3. Open the file:

    Change the above line to:

    Example:

  4. Save the file.

  5. Run the following command to reload the changed configurations:

You have successfully migrated your Zephyr instance from being operated by a root user to a non-root user.