- run `./add-user.sh` to create a user, used for remote ssh, named debug, and its password is suanzikeji
- run `./install.sh` to install the daemon and service file
+- On local machine
+ - Linux, run `apt-get install sshpass`
+ - Mac OSX, sshpass is not in brew. To install this,
+ - `brew create https://sourceforge.net/projects/sshpass/files/sshpass/1.05/sshpass-1.05.tar.gz --force`
+ - `brew install sshpass`
+ - run `pip install paho-mqtt`
+
## Usage
-To connect to remote embedded device, your should know the device's MAC address.
-1. run `./sztool -i 2acdeb93b285`
+### list all connected device
+
+`./sztool list`
+
+The output,
+
+```
+debian@[~/project/remote-ssh]>> ./sztool list
+Mac: 080027a6f8dc
+Connected with result code 0
+Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'list', 'data': 'OK'}
+list
+2acdeb93b285 OK
+timeout
+```
+
+### Connect to the device
+
+1. Run `./sztool connect 2acdeb93b285`
-where `2acdeb93b285` is the MAC address of rpdzkj board, which you want to
-connect.
+The output
-2. If it succeed, it will return the forwarding port on `autossh.suanzi.ai`
-here is a sample
```
-debian@[~/project/remote-ssh]>> ./sztool -i 2acdeb93b285
+debian@[~/project/remote-ssh]>> ./sztool list
+Mac: 080027a6f8dc
+
+Found 3 connected devices:
Connected with result code 0
-2acdeb93b285-response 32171
-port is 32171
-run ssh debug@autossh.suanzi.ai -p 32171 to connect to 2acdeb93b285 device
+
+ Device ID Data
+------------------------------
+00044b8d6310 OK
+502b73d42c31 OK
+b0f1ec7a62ce OK
```
-3. run `ssh debug@autossh.suanzi.ai -p 32171`, then you can ssh to remote
- device. The password is 'suanzikeji', create in file `add-user.sh`
+```
+debian@[~/project/remote-ssh]>> ./sztool connect 2acdeb93b285
+Mac: 080027a6f8dc
+Connected with result code 0
+Receive topic:080027a6f8dc payload: {'type': 'response', 'from': '2acdeb93b285', 'command': 'ssh', 'data': 32176}
+ssh
+run "ssh debug@autossh.suanzi.ai -p 32176" to connect to device (2acdeb93b285)
+```
+2. Run `ssh debug@autossh.suanzi.ai -p 32176`, to ssh to remote device, password is 'suanzikeji', create in file `add-user.sh`
## Note
- After the port is generated, the ssh session alive time is 5 min (defined by ALIVE_TIME in suanzi-support).