diff --git a/templates/ssh/sshd_config.erb b/templates/ssh/sshd_config.erb
index 91c8cd4c1a58e18a356e3b938dde83c76adaaf6d..115f2c6c53954974ffe4f1c0e583f4246054804b 100644
--- a/templates/ssh/sshd_config.erb
+++ b/templates/ssh/sshd_config.erb
@@ -8,25 +8,26 @@
   # Split the ports at the commas.
   ports = @listen_ports.split(',')
   ports.each do |port|
-
 -%>
 Port <%= port %>
-<%
+<%-
   end
 -%>
 
-<%
+<%-
   if (@listen_addresses != 'all')
     # Split the addresses at the commas.
     addresses = @listen_addresses.split(',')
     addresses.each do |address|
 -%>
 ListenAddress <%= address %>
-<%
+<%-
     end
-  end
 -%>
 
+<%-
+  end
+-%>
 # Only support protocol version 2.
 Protocol 2