Chroot Done Right check wether you can chroot and where to /var/empty is always a good candidate chroot to homedir is often good for a seperate user set to /var/empty, but is changeable without recompile if (chroot(pw->pw_dir) == -1) fatal("chroot"); if (chdir("/") == -1) fatal("chdir(\"/\")"); do not forget the chdir!