summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run
diff options
context:
space:
mode:
Diffstat (limited to 'abs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run')
-rwxr-xr-xabs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run20
1 files changed, 20 insertions, 0 deletions
diff --git a/abs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run b/abs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run
new file mode 100755
index 0000000..a019e5d
--- /dev/null
+++ b/abs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run
@@ -0,0 +1,20 @@
+#!/bin/bash
+exec 2>&1
+nobodydir=/data/srv/.nobody_ssh
+
+[ -f /etc/ssh/ssh_host_key ] || { /usr/bin/ssh-keygen -t rsa1 -N "" -f /etc/ssh/ssh_host_key >/dev/null; }
+ [ -f /etc/ssh/ssh_host_rsa_key ] || { /usr/bin/ssh-keygen -t rsa -N "" -f /etc/ssh/ssh_host_rsa_key >/dev/null; }
+ [ -f /etc/ssh/ssh_host_dsa_key ] || { /usr/bin/ssh-keygen -t dsa -N "" -f /etc/ssh/ssh_host_dsa_key >/dev/null; }
+
+if [ ! -f $nobodydir/id_dsa.pub ]
+then
+ mkdir -p $nobodydir
+ ssh-keygen -t dsa -N '' -f $nobodydir/id_dsa
+ mkdir -p /data/home/mythtv/.ssh
+ cp $nobodydir/id_dsa.pub /data/home/mythtv/.ssh/authorized_keys
+ chmod 700 /data/home/mythtv/.ssh/
+ chown -R mythtv:mythtv /data/home/mythtv/.ssh/
+fi
+chown -R nobody:nobody $nobodydir
+chmod 700 $nobodydir
+exec /usr/sbin/sshd -D >/dev/null 2>/dev/null