Module | RHC::SSHHelpers |
In: |
lib/rhc/ssh_helpers.rb
|
return supplied ssh executable, if valid (executable, searches $PATH). if none was supplied, return installed ssh, if any.
Public: Generate an SSH key and store it in ~/.ssh/id_rsa
type - The String type RSA or DSS. bits - The Integer value for number of bits. comment - The String comment for the key
Examples
generate_ssh_key_ruby # => /home/user/.ssh/id_rsa.pub
Returns nil on failure or public key location as a String on success
for an SSH public key specified by ‘key’, return a triple [type, content, comment] which is basically the space-separated list of the SSH public key content
For Net::SSH versions (< 2.0.11) that does not have Net::SSH::KeyFactory.load_public_key, we drop to shell to get the key‘s fingerprint
Public: Run ssh command on remote host
host - The String of the remote hostname to ssh to. username - The String username of the remote user to ssh as. command - The String command to run on the remote host. compression - Use compression in ssh, set to false if sending files. request_pty - Request for pty, set to false when pipe a file. block - Will yield this block and send the channel if provided.
Examples
ssh_ruby('myapp-t.rhcloud.com', '109745632b514e9590aa802ec015b074', 'rhcsh tail -f $OPENSHIFT_LOG_DIR/*"') # => true
Returns true on success
Public: Run ssh command on remote host and pipe the specified file contents to the command input
host - The String of the remote hostname to ssh to. username - The String username of the remote user to ssh as. command - The String command to run on the remote host. filename - The String path to file to send.
Public: Run ssh command on remote host and pipe the specified url contents to the command input
host - The String of the remote hostname to ssh to. username - The String username of the remote user to ssh as. command - The String command to run on the remote host. content_url - The url with the content to pipe to command.