summaryrefslogtreecommitdiff
path: root/EndoForge/openssh/run-sshd
diff options
context:
space:
mode:
Diffstat (limited to 'EndoForge/openssh/run-sshd')
-rwxr-xr-xEndoForge/openssh/run-sshd24
1 files changed, 14 insertions, 10 deletions
diff --git a/EndoForge/openssh/run-sshd b/EndoForge/openssh/run-sshd
index 29615fb..20e82d8 100755
--- a/EndoForge/openssh/run-sshd
+++ b/EndoForge/openssh/run-sshd
@@ -1,4 +1,9 @@
1#!/bin/sh 1#!/bin/sh
2# Fix file ownership with fakeroot so that OpenSSH will run as a user.
3#
4# The ownership is not really changed on disk, but 'chmod go-w' might actually
5# change permissions on disk.
6
2case "$LD_PRELOAD" in 7case "$LD_PRELOAD" in
3 libfakeroot-sysv.so) ;; 8 libfakeroot-sysv.so) ;;
4 '') exec fakeroot -- "$0" "$@" ;; 9 '') exec fakeroot -- "$0" "$@" ;;
@@ -7,20 +12,19 @@ esac
7 12
8fixperms() 13fixperms()
9{ 14{
10 set -- 15 set -- "$1"
11 dirs=$HOME 16 local p="$1" oldp=
12 p=$HOME 17 while [ "$p" != "$oldp" ]
13 while [ "$p" != "${p%/*}" ]
14 do 18 do
15 p=${p%/*} 19 oldp=$p
16 dirs="$dirs $p/" 20 p=${p%/*}/
21 set -- "$@" "$p"
17 done 22 done
18 23 chown root:root "$@"
19 chown root:root $dirs 24 chmod go-w "$@"
20 chmod go-w $dirs
21} 25}
22 26
23fixperms 27fixperms "$HOME"/.ssh
24 28
25PATH=/sbin:/usr/sbin:$PATH 29PATH=/sbin:/usr/sbin:$PATH
26cmd="$(which sshd) $*" 30cmd="$(which sshd) $*"