-cat <<EOF >> "$TEMPDIR"/testuser/.ssh/config
-UserKnownHostsFile $TEMPDIR/testuser/.ssh/known_hosts
-IdentityFile $TEMPDIR/testuser/.ssh/no-such-identity
-ProxyCommand $TEMPDIR/testuser/.ssh/proxy-command %h %p $SOCKET
+# set up environment for testuser
+export HOME="$TEMPDIR"/testuser
+export GNUPGHOME="$HOME"/.gnupg
+export SSH_ASKPASS="$HOME"/.ssh/askpass
+export MONKEYSPHERE_HOME="$HOME"/.monkeysphere
+
+cat <<EOF >> "$HOME"/.ssh/config
+UserKnownHostsFile $HOME/.ssh/known_hosts
+IdentityFile $HOME/.ssh/no-such-identity
+ProxyCommand $HOME/.ssh/proxy-command %h %p $SOCKET