X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=src%2Fsftpchroot.pl;h=07cc10ae2f85c402ffd20de211fc7f96896b2485;hp=a4f8ed4507c4ac8744d433790f5fd11e8974cba3;hb=ea9e4c327bfd50d4c64b590b1444ac6959156bc8;hpb=cb67142b5a384c0431e1d38626f3f281031cd88e diff --git a/src/sftpchroot.pl b/src/sftpchroot.pl index a4f8ed4..07cc10a 100755 --- a/src/sftpchroot.pl +++ b/src/sftpchroot.pl @@ -7,10 +7,14 @@ use strict; use warnings; my $CMD="/usr/libexec/openssh/sftp-server"; -my $PATH="/tmp"; +my $PATH="/FIXME"; +my $UID=FIXME; %ENV=(); # Prevent: Insecure $ENV{PATH} while running with -T switch chroot $PATH or die "chroot: $PATH: $!"; +($<,$>)=($UID,$UID); +$<==$UID or die "real UID==$<, expected $UID"; +$>==$UID or die "EUID==$>, expected $UID"; chdir "/" or die "chdir: $!"; exec $CMD; die "$CMD: $!";