summaryrefslogtreecommitdiff
path: root/regress/sftp-chroot.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/sftp-chroot.sh')
-rw-r--r--regress/sftp-chroot.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh
new file mode 100644
index 000000000..03b9bc6d7
--- /dev/null
+++ b/regress/sftp-chroot.sh
@@ -0,0 +1,25 @@
1# $OpenBSD: sftp-chroot.sh,v 1.2 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain.
3
4tid="sftp in chroot"
5
6CHROOT=/var/run
7FILENAME=testdata_${USER}
8PRIVDATA=${CHROOT}/${FILENAME}
9
10if [ -z "$SUDO" ]; then
11 echo "skipped: need SUDO to create file in /var/run, test won't work without"
12 exit 0
13fi
14
15$SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \
16 fatal "create $PRIVDATA failed"
17
18start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /"
19
20verbose "test $tid: get"
21${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \
22 fatal "Fetch ${FILENAME} failed"
23cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"
24
25$SUDO rm $PRIVDATA