Permalink
Browse files

Add ssh_options

  • Loading branch information...
1 parent 0e0af68 commit 226cff4765a4ee39303a51f3d086f525ae00c2a8 @frsyuki frsyuki committed May 15, 2013
Showing with 37 additions and 2 deletions.
  1. +22 −0 README.md
  2. +15 −2 lib/ec2ssh/cli.rb
View
@@ -156,6 +156,28 @@ Updates ssh_config by 'my_key1' aws key:
$ ec2ssh update --aws-key my_key1
```
+## ssh options
+You can set other ssh options such as IdentityFile or User.
+
+```
+$ cat ~/.ec2ssh
+---
+path: /home/yourname/.ssh/config
+aws_keys:
+ default:
+ access_key_id: ...
+ secret_access_key: ...
+ my_key1:
+ access_key_id: ...
+ secret_access_key: ...
+regions:
+ - ap-northeast-1
+ssh_options:
+ - "IdentityFile ~/.ssh/ec2.id_rsa"
+ - "User ec2-user"
+ - "TCPKeepAlive yes"
+```
+
# How to upgrade from 1.x to 2.x
If you have used ec2ssh-1.x, it seems that you may not have '~/.ec2ssh'.
So you need execute `ec2ssh init` once to create `~/.ec2ssh`, and edit it as you like.
View
@@ -83,10 +83,23 @@ def config_path
end
def merge_sections(config)
- section_str = hosts.map { |h| <<-END }.join
+ ssh_options = dotfile['ssh_options']
+
+ section_str = hosts.map { |h|
+ section = <<-END
Host #{h[:host]}
HostName #{h[:dns_name]}
- END
+ END
+
+ unless ssh_options.nil?
+ ssh_options.each {|line|
+ section << " #{line}\n"
+ }
+ end
+
+ section
+ }.join
+
config.sections[options.aws_key] ||= SshConfig::Section.new(
options.aws_key,
section_str

0 comments on commit 226cff4

Please sign in to comment.