ruby - ssh remote server login script -
currently trying write ruby script logging-in ssh remote server using "pty" & "expect" ruby library. , try create new rails app inside remote system using script.
anyone can tell me. how logging-in remote server using ruby library ?
you should @ of examples net::ssh
, opens connection , gives block execute whatever command like, e.g.:
#!/usr/bin/env ruby require 'rubygems' require 'net/ssh' host = '192.168.1.113' user = 'username' pass = 'password' net::ssh.start( host, user, :password => pass ) do|ssh| output = ssh.exec!('ls') puts output end
(taken here)
i haven't done it, idea. given construct can run whatever program on remote server , parse output. interested in public key authorization should have @ answer this question, show how specify key-file.
Comments
Post a Comment