Sha256: 122f84772c7a239b0a580e5afaa487a9f2babdfb89b6180896d40bf99cb48441

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

module Clearsight
  class SSH
    include Methadone::CLILogging
    include Methadone::SH

    def initialize(host)
      @host = host
    end
    
    def sshify(keyname)
      commands = [
        "mkdir -p ~/.ssh",
        "touch ~/.ssh/authorized_keys",
        "chmod 744 ~/.ssh",
        "chmod 644 ~/.ssh/authorized_keys",
        "cat >> ~/.ssh/authorized_keys",
      ]
      sh "cat ~/.ssh/#{keyname} | ssh #{@host} '#{commands.join("; ")}'"
    end

  end
end
Clearsight::Ssh = Clearsight::SSH

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clearsight-1.2.0 lib/clearsight/ssh.rb