diff options
Diffstat (limited to 'regress/sftp-chroot.sh')
-rw-r--r-- | regress/sftp-chroot.sh | 25 |
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 | |||
4 | tid="sftp in chroot" | ||
5 | |||
6 | CHROOT=/var/run | ||
7 | FILENAME=testdata_${USER} | ||
8 | PRIVDATA=${CHROOT}/${FILENAME} | ||
9 | |||
10 | if [ -z "$SUDO" ]; then | ||
11 | echo "skipped: need SUDO to create file in /var/run, test won't work without" | ||
12 | exit 0 | ||
13 | fi | ||
14 | |||
15 | $SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \ | ||
16 | fatal "create $PRIVDATA failed" | ||
17 | |||
18 | start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /" | ||
19 | |||
20 | verbose "test $tid: get" | ||
21 | ${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \ | ||
22 | fatal "Fetch ${FILENAME} failed" | ||
23 | cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ" | ||
24 | |||
25 | $SUDO rm $PRIVDATA | ||