このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
01_linux:01_net:06_sshd鍵 [2014/04/04 07:21] – matsui | 01_linux:01_net:06_sshd鍵 [2015/12/04 03:39] (現在) – matsui | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== 06 sshでパスワードなしにログインするには ====== | ||
+ | ^ログイン元|| | ||
+ | |ホスト名|ssh-host01| | ||
+ | |IP|192.168.10.20| | ||
+ | |ユーザ|hoge2| | ||
+ | |||
+ | ^リモート側|| | ||
+ | |ホスト名|ssh-host02| | ||
+ | |IP|192.168.10.50| | ||
+ | |ユーザ|hoge5| | ||
+ | |||
+ | ===== ①ログイン元で鍵作成 ===== | ||
+ | |||
+ | 下記で、$HOME/ | ||
+ | |||
+ | <color red> | ||
+ | |||
+ | <code console> | ||
+ | hoge2@ssh-host01 $ ssh-keygen -t rsa ←RSA暗号方式の鍵を作成 | ||
+ | Generating public/ | ||
+ | Enter file in which to save the key (/ | ||
+ | Enter passphrase (empty for no passphrase): | ||
+ | Enter same passphrase again: | ||
+ | Your identification has been saved in / | ||
+ | Your public key has been saved in / | ||
+ | The key fingerprint is: | ||
+ | f9: | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== ②リモート側で公開鍵をコピー ===== | ||
+ | |||
+ | |||
+ | 次に、リモート側で、先ほど作成した公開鍵を ~/ | ||
+ | |||
+ | <color red> | ||
+ | <code console> | ||
+ | hoge5@ssh-host02 $ cat id_rsa.pub >> $HOME/ | ||
+ | hoge5@ssh-host01 $ chmod 600 $HOME/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== ③ログイン確認 ===== | ||
+ | |||
+ | ログイン元(ユーザ: | ||
+ | |||
+ | <code console> | ||
+ | hoge2@ssh-host01 $ ssh hoge5@[リモート側IP] | ||
+ | </ | ||
+ | |||
+ | |||
+ | {{tag> |