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:

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.

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

Example:

sudo chown -R zephyr /opt/zephyrdata
sudo chown -R <non-root_user> <NODE_DATA>

Example:

sudo chown -R zephyr /opt/nodedata

c. Migrating Zephyr Services

sudo chown -h <non-root_user> /etc/init.d/ZephyrService.sh

Example:

sudo chown -h zephyr /etc/init.d/ZephyrService.sh

If you have the file /etc/systemd/system/ZephyrService.service on your system, then you need to perform the following steps additionally.

  1. Login as a root user.

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

  3. Open the file:

    User=root

    Change the above line to:

    User=<non-root_user>

    Example:

    User=zephyr
  4. Save the file.

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

    sudo systemctl daemon-reload

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