diff --git a/scripts/chroot.sh b/scripts/chroot.sh
index d08c2f6142e0b3f4a74b5eef07dfb19124cd33d5..f340018826db6ce1fdfbd27170690f398cc49ca2 100755
--- a/scripts/chroot.sh
+++ b/scripts/chroot.sh
@@ -861,7 +861,7 @@ echo "${rfs_username}:${rfs_password}" > /tmp/user_password.list
 sudo mv /tmp/user_password.list ${DIR}/deploy/${export_filename}/user_password.list
 
 #Fixes:
-if [ -d ${tempdir}/etc/ssh/ ] ; then
+if [ -d ${tempdir}/etc/ssh/ -a "x${keep_ssh_keys}" = "x" ] ; then
 	#Remove pre-generated ssh keys, these will be regenerated on first bootup...
 	sudo rm -rf ${tempdir}/etc/ssh/ssh_host_* || true
 	sudo touch ${tempdir}/etc/ssh/ssh.regenerate || true