Method: Net::SSH::Session#initialize

Defined in:
lib/net/ssh/session.rb

#initialize(host, user, password = '', options = {}) ⇒ Session

Initialize a new ssh session

Parameters:

  • remote (String)

    hostname or ip address

  • remote (String)

    account username

  • remote (String)

    account password

  • options (Hash) (defaults to: {})

    hash



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/net/ssh/session.rb', line 24

def initialize(host, user, password='', options={})
  @host          = host
  @user          = user
  @port          = options[:port] || 22
  @password      = password
  @history       = []
  @track_history = true
  @timeout       = options[:timeout]

  if options[:history] == false
    @track_history = false
  end

  if @timeout && !@timeout.kind_of?(Integer)
    raise ArgumentError, "Timeout value should be numeric"
  end
end