我在AWS上有一個羣集,我想用SSH登錄到boto.cmdshell
。但是也許我不理解要傳遞的參數。使用botocmdshell將ssh轉換爲AWS EC2實例
該節點擁有用戶ubuntu
並且沒有密碼設置。
[Errno 2] No such file or directory: 'C:\\Users\\Neil/.ssh/known_hosts'
此錯誤是沒有意義的我:
ssh_client = sshclient_from_instance(instanceobj,
ssh_key_file =r'C:\Users\Neil\Downloads\sparkcluster.pem',
user_name ='ubuntu')`
當我運行代碼,我得到這個錯誤/我想我應該提供PEM關鍵ssh_key_file
參數。我錯過了什麼嗎?我知道用膩子工作很好。
任何幫助將會很棒!
從putty終端顯示ls -l〜/ .ssh是什麼? –
只提供了一個有效的路徑到'sshclient_from_instance(host,key_file =「path_to_file」,...)中的hostkey文件或一個空白文件''參見https://github.com/boto/boto/blob/master/boto /manage/cmdshell.py。請注意,這是known_hosts文件,而不是您的私鑰。如果你沒有一個空白文件,就創建一個空白文件。 – tintin
@RodrigoM ls -l in .ssh顯示,-rw ------- 1 ubuntu ubuntu 1606 Jan 16 10:34 authorized_keys -rw ------- 1 ubuntu ubuntu 1679 Jan 16 10:01 id_rsa -rw-r - r-- 1 ubuntu ubuntu 404 Jan 16 10:01 id_rsa.pub -rw-r - r-- 1 ubuntu ubuntu 2664 Jan 18 01:21 known_hosts – Neil