「SSH 公開鍵の生成」の版間の差分

提供: dsk's note
移動: 案内検索
 
(同じ利用者による、間の1版が非表示)
1行目: 1行目:
 +
{{google/ad/01}}
 +
 
SSHでリモートに接続する際に、毎度パスワードを入力する必要があるが、公開鍵認証を利用する事で、入力する手間を省く事ができる。
 
SSHでリモートに接続する際に、毎度パスワードを入力する必要があるが、公開鍵認証を利用する事で、入力する手間を省く事ができる。
 
それには、id_rsa (秘密鍵)id_rsa.pub (公開鍵)を生成する必要がある。
 
それには、id_rsa (秘密鍵)id_rsa.pub (公開鍵)を生成する必要がある。
4行目: 6行目:
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
ssh-keygen -t rsa
 
ssh-keygen -t rsa
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight lang="bash">
 
Generating public/private rsa key pair.
 
Generating public/private rsa key pair.
 
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
 
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
27行目: 32行目:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
しておきます。
 
しておきます。
 +
 +
[[Category: UNIX/Linux]]
 +
[[Category: SSH]]
 +
[[Category: さくらインターネット]]
 +
 +
{{google/ad/01}}

2016年2月4日 (木) 05:50時点における最新版

SSHでリモートに接続する際に、毎度パスワードを入力する必要があるが、公開鍵認証を利用する事で、入力する手間を省く事ができる。 それには、id_rsa (秘密鍵)id_rsa.pub (公開鍵)を生成する必要がある。

ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/username/.ssh/id_rsa):
/Users/username/.ssh/id_rsa already exists.
Overwrite (y/n)? 
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/username/.ssh/id_rsa.
Your public key has been saved in /Users/username/.ssh/id_rsa.pub.

生成されたid_rsa.pubを表示すると以下のような長い文字列が生成されている。

ssh-rsa AAAAB3〜〜〜〜〜〜〜〜〜/ username@mac.local

authorized_keysを作成して、コピペしておく。

vi /home/username/.ssh/authorized_keys

忘れずに、

chmod 600 authorized_keys

しておきます。