Method: Inception::Cli#share_ssh

Defined in:
lib/inception/cli.rb

#share_ssh(name = settings.inception.name) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/inception/cli.rb', line 65

def share_ssh(name=settings.inception.name)
  user = settings.inception.provisioned.username
  host = settings.inception.provisioned.host
  private_key_path = "~/.ssh/#{name}"
  private_key = settings.inception.key_pair.private_key
  say <<-EOS
To access the inception server, add the following to your ~/.ssh/config

  Host #{name}
User #{user}
Hostname #{host}
IdentityFile #{private_key_path}

Create a file #{private_key_path} with all the lines below:

#{private_key}

Change the private key to be read-only to you:

  $ chmod 700 ~/.ssh
  $ chmod 600 #{private_key_path}

You can now access the inception server running either:

  $ ssh #{name}
  $ ssh #{name} -t "tmux attach || tmux new-session"

EOS
end