1 # $OpenBSD: sftp-chroot.sh,v 1.6 2018/02/09 03:42:57 dtucker Exp $
2 # Placed in the Public Domain.
7 FILENAME=testdata_${USER}
8 PRIVDATA=${CHROOT}/${FILENAME}
10 if [ -z "$SUDO" -a ! -w /var/run ]; then
11 echo "need SUDO to create file in /var/run, test won't work without"
16 if ! $OBJ/check-perm -m chroot "$CHROOT" ; then
17 echo "skipped: $CHROOT is unsuitable as ChrootDirectory"
21 $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \
22 fatal "create $PRIVDATA failed"
24 start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /"
26 verbose "test $tid: get"
27 ${SFTP} -S "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY \
28 >>$TEST_REGRESS_LOGFILE 2>&1 || \
29 fatal "Fetch ${FILENAME} failed"
30 cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"