Remote logon
The IoT Platform console provides a Secure Shell (SSH) remote logon service for devices. To use this service, a device must establish an SSH logon channel with IoT Platform. You can enable remote logon in the console to trigger IoT Platform to send the SSH channel connection information to a device. Alternatively, a device can request this information. This topic describes the request topic that a device uses to obtain SSH channel connection information.
Background information
For more information about developing the device-side feature for SSH remote logon, see Example of enabling remote logon from a device.
After the SSH remote channel is established for the device, you can remotely access the device from the IoT Platform console. For more information, see Log on to a device remotely.
Request SSH remote channel authentication information
- Request topic:
/sys/${productKey}/${deviceName}/secure_tunnel/proxy/request.A device uses this topic to request SSH channel connection information from IoT Platform. No request data is required.
- Response topic:
/sys/${productKey}/${deviceName}/secure_tunnel/proxy/request_reply.Response data format:
{ "tunnel_id":"2wde***", "token":"6d57029c-f***9-24a4b4a4f3a6", "uri":"wss://secure-tunnel.iot.aliyun.com:443", "host":"secure-tunnel.iot.aliyun.com", "port":"443", "token_expire":1000 }Table 1. Response parameter descriptions Parameter Type Description tunnel_id String The ID of the SSH remote channel. token String The authentication token for the device to establish a WebSocket connection with the SSH remote channel. Note A new token is valid for 7 days. When a device requests connection information, if the existing token for the device was generated more than 5 days ago, IoT Platform updates the connection information before responding.uri String The URL for the device to establish a WebSocket connection with the SSH remote channel. host String uri. port String uri. token_expire Integer token in seconds. Note- token expires, the device receives a shutdown notification and must close the SSH channel.
If the token expires and the device does not actively close the SSH channel, IoT Platform automatically closes the SSH channel 5 seconds after the token expires.
- The device must periodically request updated connection information and use the new information to reconnect to the SSH channel. This prevents IoT Platform from sending a shutdown notification and closing the channel when it detects that the token has expired.
- token expires, you can also manually disable the remote logon feature to disconnect the device from the SSH remote channel. For more information, see Disable remote logon.
This operation affects only the current SSH channel connection and does not prevent future connections. The device can establish a new SSH channel connection by requesting the connection information again.
- token expires, the device receives a shutdown notification and must close the SSH channel.