我有些困难,找不到指定SFTP身份验证密钥的文档。我希望有类似这样的东西:
export SOME_PRIVATE_KEY="$(cat tmp/some-certs/privatekey.pem)"
# then somewhere in the code
private_key = OpenSSL::PKey::RSA.new(ENV['SOME_PRIVATE_KEY'])
Net::SFTP.start(ftp_host, user, key: private_key) do |sftp|
sftp.dir.entries('/path/to/folder').each do |remote_file|
# ...
end
end