-echo "### testuser connecting to sshd socket..."
-
-ssh-agent bash -c \
- "monkeysphere subkey-to-ssh-agent && ssh -F $TEMPDIR/testuser/.ssh/config testhost"
+echo "### ssh connection test for success..."
+ssh_test
+
+# remove the testuser's authorized_user_ids file and update
+# authorized_keys file, this is to make sure that the ssh
+# authentication FAILS...
+echo "### removing testuser authorized_user_ids and reupdating authorized_keys..."
+rm -f "$TEMPDIR"/testuser/.monkeysphere/authorized_user_ids
+monkeysphere-server update-users $(whoami)
+
+# make sure the user can NOT connect
+echo "### ssh connection test for server authentication denial..."
+ssh_test
+ret="$?"
+if [ "$ret" != '255' ] ; then
+ echo "### connection should have failed!"
+ exit "$ret"
+fi