diff --git a/tools/setup-ssh b/tools/setup-ssh
index e285092500a976432f767a103eca196249b267dd..02b6fbf7fe7f2a05d340e6d921b9a7e857ef14ea 100755
--- a/tools/setup-ssh
+++ b/tools/setup-ssh
@@ -220,6 +220,7 @@ def main():
   SetupLogging(options)
 
   passwd = getpass.getpass(prompt="%s password:" % constants.GANETI_RUNAS)
+  ssh_port = netutils.GetDaemonPort("ssh")
 
   # Below, we need to join() the transport objects, as otherwise the
   # following happens:
@@ -231,7 +232,7 @@ def main():
   #   now
 
   for host in args:
-    transport = paramiko.Transport((host, netutils.GetDaemonPort("ssh")))
+    transport = paramiko.Transport((host, ssh_port))
     try:
       transport.connect(username=constants.GANETI_RUNAS, password=passwd)
     except Exception, err: