1
腳本類似於下面我試圖在遠程服務器使用SSH執行python腳本,但未能
client = paramiko.SSHClient()
client.load_host_keys('/user/hokale')
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
my_key = paramiko.RSAKey.from_private_key_file('/user/hokale')
client.connect(hostname=host, username=user, password=password,pkey=my_key)
目前@ locaton /user/hokale
遠程腳本。在load_host_keys API或paramiko.RSAKey.from_private_key_file
失敗說
in load
with open(filename, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory:/user/hokale
請建議的解決方案
並且遠程服務器上存在/ user/hokale? –