You can use this if you just want to run the program without your configuration files, but you trust that the program is not malicious and not to try to look outside the box.
I wrote a little something a while back that sets up a temporary directory and starts a shell with a minimal environment. I use this many times daily to test my solutions to questions for this site.
FreeBSD users can also use the
The command is called
shell and creates a temporary disposable working directory, optionally pre-populated with the contents of another directory, and starts a shell in it. When the shell session exits, the temporary directory is disposed of (depending on command line flags used).
This can also be used to start another shell other than the user's login shell.
It doesn't create a temporary user (as this would require administrative permissions), but it does set the
HOME variable to the temporary directory, which means that any references to
~ would resolve to the temporary directory and not to the "real home" of the user. It is not a "safe" environment in the sense that the rest of the system is protected, but it provides an interactive shell in a throw-away directory where created files and directories will be cleaned up when finished with minimal impact from your ordinary shell environment.
[box] $ shell -s "$HOME/skel" zsh
shell: info: Copying /home/kk/skel into /tmp_mfs/shell-zsh.5IAh9F2B
shell: info: Starting /usr/local/bin/zsh in /tmp_mfs/shell-zsh.5IAh9F2B
$ ls -a
. .Xdefaults .cvsrc .mailrc .vimrc
.. .cshrc .login .profile .zshrc
$ echo "$HOME"
shell: info: Removing /tmp_mfs/shell-zsh.5IAh9F2B
It doesn't do
chroot or anything fancy like that. It's basically a glorified wrapper around