用户工具

站点工具


atk:ssh_keys

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
后一修订版
前一修订版
atk:ssh_keys [2019/06/30 16:41] – [Windows] xie.congweiatk:ssh_keys [2019/06/30 16:47] (当前版本) – [参考] xie.congwei
行 95: 行 95:
 ===== 测试无密码的 SSH 连接 ===== ===== 测试无密码的 SSH 连接 =====
  
 +===== 测试无密码的 SSH 连接 =====
  
-===== 参考 =====+我们在这里提供了一个 QuantumATK 脚本,它将尝试建立与远程集群的连接,并报告连接是否成功建立。
  
 +  * 下载脚本 [[https://docs.quantumwise.com/_downloads/ssh_test.py|↓ ssh_test.py]],在第 7 行到第 9 行编辑连接设置(//key_dir//、//hostname// 和 //username//)。
 +
 +<code python>  
 +1    from NL.ComputerScienceUtilities.SSHConnection import SSHConnection
 +2    import os
 +3    
 +4    # -------------------------------------- #
 +5    # Edit only these 3 settings
 +6    # -------------------------------------- #
 +7    key_dir  = 'path_to_SSH_keys'
 +8    hostname = 'HOST.CLUSTER.EDU'
 +9    username = 'my_user_name'
 +10   
 +11   # -------------------------------------- #
 +12   port = 22
 +13   ok = os.path.isdir(key_dir)
 +14   if ok:
 +15       print("Sucessfully found local dir with SSH keys.")
 +16       con = SSHConnection(hostname, port, username, key_dir)
 +17       con.connect()
 +18       ok = con.isConnected()
 +19       
 +20       if ok:
 +21           print("Connection succesful.")
 +22   else:
 +23       print("Error: Could not find local dir with SSH keys.")
 +24   # -------------------------------------- #
 +</code>
 +
 +  * 从命令行执行:
 +
 +<code python>  
 +$ atkpython ssh_test.py
 +</code>
 +
 +  * 如果测试通过,则会打印出以下行:
 +<code python>  
 +Successfully found local dir with SSH keys.
 +Connection successful.
 +</code>
 +
 +
 +<WRAP center tip 100%>
 +=== 提示 ===
 +您现在应该已准备好使用 QuantumATK 作业管理器在远程集群上运行的 QuantumATK 作业,请参阅教程 [[https://docs.quantumwise.com/tutorials/job_manager_remote/job_manager_remote.html#job-manager-remote|Job Manager for remote execution of QuantumATK scripts]]。
 +</WRAP>
 +
 +===== 参考 =====
  
 +  * 英文原文:https://docs.quantumwise.com/tutorials/ssh_keys/ssh_keys.html
  
  
  
  
atk/ssh_keys.1561884089.txt.gz · 最后更改: 2019/06/30 16:41 由 xie.congwei

© 2014-2022 费米科技(京ICP备14023855号