我有這樣的代碼:Ruby-如何連接遠程服務器並在其上運行命令?
require 'rubygems'
require 'net/ssh'
hostname = '1.2.3.4'
username = 'user'
cmd = "ls -al"
ssh = Net::SSH.start(hostname, username)
res = ssh.exec!(cmd)
ssh.close
puts res
這裏談到的錯誤:
Authentication failed for user [email protected] (Net::SSH::AuthenticationFailed)
我如何才能找到這個問題?