diff options
Diffstat (limited to 'EndoForge/openssh/run-sshd')
-rwxr-xr-x | EndoForge/openssh/run-sshd | 24 |
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 | |||
2 | case "$LD_PRELOAD" in | 7 | case "$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 | ||
8 | fixperms() | 13 | fixperms() |
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 | ||
23 | fixperms | 27 | fixperms "$HOME"/.ssh |
24 | 28 | ||
25 | PATH=/sbin:/usr/sbin:$PATH | 29 | PATH=/sbin:/usr/sbin:$PATH |
26 | cmd="$(which sshd) $*" | 30 | cmd="$(which sshd) $*" |