summaryrefslogtreecommitdiffstats
path: root/abs/mv-core/runit-scripts-mv/runitscripts/services/sshd/run
blob: a019e5d7c4ea17186510218ebfb6c4ed3695dbe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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