Advertisement
Guest User

net-ssh

a guest
Feb 14th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. require 'rubygems'
  2. require 'csv'
  3. require 'net/ssh'
  4.  
  5.  
  6. CSV.foreach("serverlist.csv",',') do |server|
  7. host = server[0]
  8. username = server[1]
  9. passwd = server[2]
  10. command = "/bin/ls"
  11.  
  12. Net::SSH.start(host, username, :password => passwd) do |ssh|
  13. result = ssh.exec!(command)
  14. puts result
  15. ssh.close
  16. end
  17. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement