Chrooted /tmp directory
There is also a new method that ensures that no processes currently accessing /tmp are interrupted in any way. This also ensures that your /tmp that allows execution is never accessible to currently running processes. This limits your exposure to possible exploits.
First, create a chrooted environment that contains a tmp directory that allows file execution:
root@vps01:~# mkdir -p /root/chroot /root/tmp root@vps01:~# mount --bind / /root/chroot root@vps01:~# mount --bind /root/tmp /root/chroot/tmp root@vps01:~#
Next chroot into the environment you created.
root@vps01:~# chroot /root/chroot root@vps01:/#
At this point, you are in the chrooted environment and can run any commands you need to. When you are done, simply type the command ‘exit’.
root@vps01:/# exit exit root@vps01:~#
Now you are back to your normal environment.