Preparing Installation and Running Users

  • Installation user: user who installs the NPU driver and firmware and CANN package.
  • Running user: user who runs services on the NPU driver, firmware, and CANN.

Create installation and running users by referring to Table 1.

Table 1 User types

Component

Installation user

Running user

Drivers and firmware

root

  • When the driver and firmware are installed, the running user and user group are HwHiAiUser by default. You need to create the running user and user group of HwHiAiUser before installing the software package.
  • If the created user and user group are not HwHiAiUser, you must specify the running user when installing the driver and firmware.

CANN

root

All users can run services.

Non-root user

  • When the CANN software is installed using the --install-for-all parameter, all users can run services.
  • If the CANN software does not use the --install-for-all parameter, the installation user and running user must be the same.

The following users are used in the example steps in this document:

  • Install the driver and firmware as the root user.
  • Install the CANN software as a non-root user HwHiAiUser (default running user of the driver and firmware).
Run the following command to create the HwHiAiUser user and user group:
1
2
groupadd HwHiAiUser
useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash

To create other users, perform the following steps: Note that if the --install-for-all parameter is not used during driver and firmware installation, the running user of the CANN software package and the running user of the driver and firmware must be in the same user group.

Run the following commands as the root user. Replace <usergroup> and <username> with the actual user names.
  1. Create a non-root user.
    1
    2
    groupadd <usergroup>
    useradd -g <usergroup> -d /home/<username> -m <username> -s /bin/bash
    
  2. Set the password for the non-root user.
    1
    passwd <username>
    
  • You are not advised adding the CANN running user to the root user group because permission control may cause security risks. Therefore, exercise caution when adding the running user to the root user group.
  • After the running user is created, do not disable the login authentication function of the user.
  • The password must meet the password complexity requirements. For details, see Password Complexity Requirements. The password validity period is 90 days. You can change the validity period in the /etc/login.defs file or using the chage command. For details, see Setting User Account Validity Period.