#/usr/bin/bash #/usr/bin/sh # # Script: test-chroot <- no .sh this is a command like whoami # Author: hynt@speed-mailer.com # Date: 2015-04-19 - 01 (ee = times edited) # # Purpose: Detecting a chroot jail from within # without root privileges? # # Notes: sudo chmod u=rwx,g=rx,o=r test-chroot # sudo cp test-chroot /bin # Now you write test-chroot, # And the program starts--- # clear echo "☢TEST-CHROOT☢" echo "-------------------------------" echo "If you are not in a chroot" echo "the inode for / will always be 2" echo "now check that is: ☻" echo "-------------------------------" printf 'Inode: %s\n' $( stat -c %i / ) printf ' User: %s\n' $( whoami ) printf ' Path: %s\n' $( pwd ) echo "-------------------------------"