LoginSignup
10
9

More than 5 years have passed since last update.

SSH接続を楽にする。(自分用まとめ)

Last updated at Posted at 2013-05-15

1.~/.ssh/configを設定して、ssh exとかでSSH接続できるようにする。

設定例


Host ex
  HostName      example.com
  user          ex_user
  IdentityFile  ~/.ssh/id_rsa.pub

参考URL

2.秘密鍵を設定してパスワードなしログイン

ssh-keygen で公開鍵を作って、以下①か②の方法で公開鍵をリモート先に設定する。

①ssh-copy-idでお手軽設定※1


ssh-copy-id -i ~/.ssh/id_rsa.pub ex_user@example.com

②catをパイプでつないでsshで飛ばす。


cat ~/.ssh/id_rsa.pub | ssh ex 'cat >>~/.ssh/authorized_keys'

※1 参考URLにも書いてあるけどssh-copy-idが使えるのはFreeBSD系らしい。
でも今回自分でやったのはローカルUbuntu12.04でリモートがCentOS6.4だった。
Debian系もいける?

参考URL

書いてみたけど、全部2つ目の参考URLに載ってた。
まぁ自分なりまとめってことでひとつ。

10
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
9