Managing device passwords
For devices and registries to begin exchanging data and commands, you need to log in. This section describes how to manage device passwords for the appropriate authorization method.
Note
When using an X.509 certificate along with a password, the password has higher priority.
Adding a password to a device
You can add a password to an already created device or set it when creating a device using the --password
parameter.
Note
You can also set a password from the input stream. To do this, use the --read-password
flag instead of the --password
parameter.
Adding a password to an existing device
To add a password to an existing device:
- In the management console, select the folder where you want to add a password to an existing device.
- Select Yandex IoT Core.
- Select the registry with the desired device from the list.
- In the left part of the window, select Devices.
- Select the desired device from the list.
- Under Passwords, click Add password.
- In the Password field, set a password that you'll use to access the device.
To do this, you can use a password generator.
Don't forget to save your password because you'll need it later. - Click Add.
If you don't have the Yandex.Cloud command line interface yet, install and initialize it.
To add a password:
-
Get a list of devices in the registry:
$ yc iot device --registry-name my-registry list +----------------------+--------+ | ID | NAME | +----------------------+--------+ | arenak5ciqss6pbas5tm | second | | areqjd6un3afc3cefuio | first | +----------------------+--------+
-
Add a password to the device:
$ yc iot device password add --device-name first --password Passw0rdForDevice device_id: areqjd6un3afc3cefcvm id: areqjd6un3afc3cefuio created_at: "2019-12-16T15:11:36.892167Z"
Setting a password for a device when creating it
For information about how to set a password for a device when creating it, see Creating a device.
If you don't have the Yandex.Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To set a password when creating a device:
-
Get a list of registries in the folder:
$ yc iot registry list +----------------------+-------------------+ | ID | NAME | +----------------------+-------------------+ | arenou2oj4ct42eq8f4m | my-registry | +----------------------+-------------------+
-
Create a device with a password:
$ yc iot device create --registry-name my-registry --name device-with-pass --password Passw0rdForDevice id: arepomfambsg5biqc25n registry_id: arenou2oj4ct42eq8g3n created_at: "2019-12-16T15:18:39.358922Z" name: device-with-pass
Getting a list of device passwords
To view the list of device passwords:
- In the management console, select the folder where you want to get a list of device passwords.
- Select Yandex IoT Core.
- Select the registry with the desired device from the list.
- In the left part of the window, select Devices.
- Select the desired device from the list.
- On the Overview page, go to the Passwords section.
The list of device passwords is displayed in the Passwords section.
If you don't have the Yandex.Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To get a list of passwords:
-
Get a list of devices in the registry:
$ yc iot device --registry-name my-registry list +----------------------+------------------+ | ID | NAME | +----------------------+------------------+ | arenak5ciqss6pbas5tm | second | | arepomfambsg5biqc77p | device-with-pass | | areqjd6un3afc3cefuio | first | +----------------------+------------------+
-
Get a list of device passwords:
$ yc iot device password list --device-name device-with-pass +----------------------+---------------------+ | ID | CREATED AT | +----------------------+---------------------+ | areuin5t7pndvlj6n4tr | 2019-12-16 15:18:39 | +----------------------+---------------------+
Deleting a device password
To delete a device password:
- In the management console, select the folder to delete a device password from.
- Select Yandex IoT Core.
- Select the registry with the desired device from the list.
- In the left part of the window, select Devices.
- Select the desired device from the list.
- To the right of the password to delete, click , and select Delete from the drop-down list.
- In the window that opens, click Delete.
If you don't have the Yandex.Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
To delete a password:
-
Get a list of device passwords:
$ yc iot device password list --device-name device-with-pass +----------------------+---------------------+ | ID | CREATED AT | +----------------------+---------------------+ | areuin5t7pndvlj6n4tr | 2019-12-16 15:18:39 | +----------------------+---------------------+
-
Delete the password:
$ yc iot device password delete --device-name device-with-pass --password-id areuin5t7pndvlj6n4tr
-
Make sure that the password was deleted:
$ yc iot device password list --device-name device-with-pass +----+------------+ | ID | CREATED AT | +----+------------+ +----+------------+