--- /dev/null
+#!/bin/bash
+
+# Add a new user named debug, with password hard2guess for remote debug
+# the suanzi-support daemon will be running as this user
+# run : sudo ./add-user.sh
+
+USER="debug"
+PASS="hard2guess"
+
+echo "Create $USER user"
+useradd -m "${USER}" || exit 1
+
+echo "set the password of $USER"
+echo -e "${PASS}\n${PASS}" | passwd "$USER" || exit 1
+
+echo "Done"
+
if msg.topic == id + '-response':
port = msg.payload
print 'port is', str(port)
- print 'run ssh user@autossh.suanzi.ai -p ' + str(port) + ' to connect to ' + id + ' device'
+ print 'run ssh debug@autossh.suanzi.ai -p ' + str(port) + ' to connect to ' + id + ' device'
client = mqtt.Client()
client.on_connect = on_connect
from subprocess import call, Popen, PIPE, STDOUT
import paho.mqtt.client as mqtt
import shlex
-import os
import random
from uuid import getnode as get_mac
if __name__ == '__main__':
mac = hex(get_mac())
- id = os.getenv('USER') + '-' + '{:0>12}'.format(mac[2:-1])
+ id = '{:0>12}'.format(mac[2:-1])
print 'id is: ' , id
client = MyClient(id)
client.connect(MQTT_SERVER, MQTT_PORT, 60)
After=network-online.target
[Service]
-User=debian
+User=debug
Type=simple
ExecStart=/usr/local/bin/suanzi-support
ExecStop=/usr/bin/pkill -P $MAINPID