上QQ阅读APP看书,第一时间看更新
Time for action - importing users from the CLI
Now that you have created the import file, let's import it:
- Log on to the command line of your Cacti server.
- Go to the cli sub-directory under the Cacti directory:
cd /var/www/html/cacti/cli
- Place the import_user.php script in this directory.
- Put the users_list.txt file in the /tmp directory.
- Run the following command to add the users to the Local Realm with _CustomerA_user as the template user:
php import_user.php /tmp/users_list.txt _CustomerA_user 0
You just imported all users from the import file to your Cacti installation. The users now have the same permissions as the template user. Go to the user management of Cacti and you will see the users listed there:
Let us have a closer look at the CLI script import_user.php. Besides reading the command line options and several print statements, it consists of three major parts. The first part deals with input validation for the realm id, the second part reads in the import file, and the last part actually copies the user and changes the full name and realm id of the user.