Class: Vagrant::Solaris10::Cap::InsertPublicKey
- Inherits:
-
Object
- Object
- Vagrant::Solaris10::Cap::InsertPublicKey
- Defined in:
- lib/vagrant-solaris10/cap/insert_public_key.rb
Class Method Summary collapse
Class Method Details
.insert_public_key(machine, contents) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vagrant-solaris10/cap/insert_public_key.rb', line 10 def self.insert_public_key(machine, contents) contents = contents.chomp contents = Vagrant::Util::ShellQuote.escape(contents, "'") machine.communicate.tap do |comm| comm.execute("mkdir -p ~/.ssh") comm.execute("chmod 0700 ~/.ssh") comm.execute("printf '#{contents}\\n' >> ~/.ssh/authorized_keys") comm.execute("chmod 0600 ~/.ssh/authorized_keys") end end |