1 # $OpenBSD: sftp-chroot.sh,v 1.5 2016/09/26 21:34:38 bluhm 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 "skipped: need SUDO to create file in /var/run, test won't work without"
15 if ! $OBJ/check-perm -m chroot "$CHROOT" ; then
16 echo "skipped: $CHROOT is unsuitable as ChrootDirectory"
20 $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \
21 fatal "create $PRIVDATA failed"
23 start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /"
25 verbose "test $tid: get"
26 ${SFTP} -S "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY \
27 >>$TEST_REGRESS_LOGFILE 2>&1 || \
28 fatal "Fetch ${FILENAME} failed"
29 cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"