3 class CopyMyConf
< Base
5 def prepare vm
, tmp_root
6 vm
.share_folder("ssh", "#{tmp_root}/ssh", "~/.ssh")
9 def provision channel
, user_home
, tmp_root
10 puts
"Copying your ssh keys and config"
11 channel
.sudo("mkdir -p #{tmp_root}/cached && chown -R vagrant #{tmp_root}/cached")
12 channel
.execute("[[ -f #{user_home}/.ssh/authorized_keys ]] && mv #{user_home}/.ssh/authorized_keys #{tmp_root}/cached")
13 channel
.execute("cp #{tmp_root}/ssh/* #{user_home}/.ssh")
14 channel
.execute("cat #{tmp_root}/cached/authorized_keys >> #{user_home}/.ssh/authorized_keys") # So that `vagrant ssh` doesn't ask for password