Class: Synco::Shells::SSH

Inherits:
Synco::Shell show all
Defined in:
lib/synco/shells/ssh.rb

Overview

SSH shell provides access to a remote server using SSH.

Instance Attribute Summary

Attributes inherited from Synco::Shell

#arguments

Instance Method Summary collapse

Methods inherited from Synco::Shell

#connection_command, #to_s

Constructor Details

#initialize(*command, arguments: [], port: nil, key: nil, user: nil, batch_mode: nil, **options) ⇒ SSH

Returns a new instance of SSH.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/synco/shells/ssh.rb', line 16

def initialize(*command, arguments: [], port: nil, key: nil, user: nil, batch_mode: nil, **options)
	if port
		arguments << "-p" << port
	end
	
	if key
		arguments << "-i" << key
	end
	
	if user
		arguments << "-l" << user
	end
	
	unless batch_mode.nil?
		arguments << "-o" << "BatchMode=#{batch_mode ? 'yes' : 'no'}"
	end
	
	super
end

Instance Method Details

#default_commandObject



12
13
14
# File 'lib/synco/shells/ssh.rb', line 12

def default_command
	["ssh"]
end