Run service as non-root user
authorJacob Casper <dev@jacobcasper.com>
Fri, 3 Apr 2020 05:20:48 +0000 (00:20 -0500)
committerJacob Casper <dev@jacobcasper.com>
Fri, 3 Apr 2020 05:20:48 +0000 (00:20 -0500)
mercuryms.service
setup.sh [new file with mode: 0755]

index b132660..50044a8 100644 (file)
@@ -4,6 +4,9 @@ After=network.target
 
 [Service]
 Type=simple
+User=mercuryms
+Group=mercuryms
+WorkingDirectory=/usr/share/mercuryms
 ExecStart=/opt/mercuryms/bin/python /opt/mercuryms/mms-download.py
 Environment="MERCURYMS_PORT=9092"
 
diff --git a/setup.sh b/setup.sh
new file mode 100755 (executable)
index 0000000..a4698ad
--- /dev/null
+++ b/setup.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+mkdir -p /usr/share/mercuryms
+groupadd mercuryms
+useradd -g mercuryms -d /usr/share/mercuryms -s $(which nologin) mercuryms
+chown mercuryms:mercuryms /usr/share/mercuryms
+chmod 700 /usr/share/mercuryms