summaryrefslogtreecommitdiff
path: root/regress/sftp-chroot.sh
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-05-17 09:35:26 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-05-17 09:35:26 +1000
commitf3568fc62b73b50a0a3c8447e4a00f4892cab25e (patch)
tree5c29466e83c15c43178437c795b65c981e87310b /regress/sftp-chroot.sh
parentdfea3bcdd7c980c2335402464b7dd8d8721e426d (diff)
- djm@cvs.openbsd.org 2013/04/18 02:46:12
[Makefile regress/sftp-chroot.sh] test sshd ChrootDirectory+internal-sftp; feedback & ok dtucker@
Diffstat (limited to 'regress/sftp-chroot.sh')
-rw-r--r--regress/sftp-chroot.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh
new file mode 100644
index 000000000..8c07979b4
--- /dev/null
+++ b/regress/sftp-chroot.sh
@@ -0,0 +1,26 @@
1# $OpenBSD: sftp-chroot.sh,v 1.1 2013/04/18 02:46:12 djm Exp $
2# Placed in the Public Domain.
3
4tid="sftp in chroot"
5
6COPY=${OBJ}/copy
7CHROOT=/var/run
8FILENAME=testdata_${USER}
9PRIVDATA=${CHROOT}/${FILENAME}
10
11if [ -z "$SUDO" ]; then
12 fatal "need SUDO to create file in /var/run, test won't work without"
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"
21rm -f ${COPY}
22${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \
23 fatal "Fetch ${FILENAME} failed"
24cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"
25
26$SUDO rm $PRIVDATA