Show page source of guide_public_key #70420

= 公開鍵認証の設定

WinSCPで公開鍵を使った認証を行うための設定手順を説明しています。下記のページも参考にどうぞ。

 * [guide_install WinSCPのインストール方法]
 * [guide_connect 公開鍵を使用しない場合の接続方法]

[[PageOutline(start=2)]]


== 公開鍵/秘密鍵を作成する
もし公開鍵/秘密鍵を作成していない場合、[ui_puttygen PuTTYgenツール]で鍵を作成しましょう。


== サーバーの設定
SCPおよび公開鍵認証を使用してサーバーに接続するには、サーバー側での設定が必要です。詳しくはサーバーの管理者に問い合わせるか、マニュアル等を参照してください。

{{{ comment
===== Configure Server to Accept Public Key =====
Connect to your SSH server using WinSCP with the SSH protocol, using other means of authentication than public key, e.g. typically using password authentication.

Once logged in, configure your server to accept your public key. That varies with SSH server software being used:

==== OpenSSH ====
[[task_navigate|Navigate]] into the ''.ssh'' subdirectory of your account home directory. You may need to enable [[ui_pref_panels#common_options|showing hidden files]] to see the directory. If the directory does not exists, you need to [[task_create_directory|create it]] first.

Once there, open the file ''authorized_keys'' for [[task_edit|editing]] ((In earlier versions of OpenSSH 2 the file might be called ''authorized_keys2''.)). Again you may have to create this file if this is the first key you have put in it.

Then switch to the [[ui_puttygen|PuTTYgen]] window, select all of the text in the //[[ui_puttygen#authorized_keys|Public key for pasting into authorized_keys file]]// box, and copy it to the clipboard (''Ctrl+C''). Then, switch back to the editor and insert the data into the open file, making sure it ends up all on one line. Save the file.

==== ssh.com ====
[[ui_puttygen#saving_public|Save a public key file]] from [[ui_puttygen|PuTTYgen]], and copy that into the ''.ssh2'' subdirectory of your account home directory. In the same subdirectory, [[task_edit|edit]] (or create) a file called ''authorization''. In this file you should put a line like ''Key mykey.pub'', with ''mykey.pub'' replaced by the name of your key file.

==== Other SSH Servers ====
For other SSH server software, you should refer to the manual for that server.

==== Permissions ====
You may also need to ensure that your account home directory, your ''.ssh'' directory, and any other files involved (such as ''authorized_keys'', ''authorized_keys2'' or ''authorization'') are not group-writable or world-writable.

Read more about [[task_properties|changing permissions]]

}}}

== WinSCPの設定
公開鍵/秘密鍵を使用してサーバーに接続するには、「WinSCPログイン」ダイアログの「秘密鍵」で作成した秘密鍵を指定します。ホスト名やユーザー名、パスワードといったほかの情報については、公開鍵/秘密鍵を使用しない場合と同様です。
[[BR]][[Embed(pubkey_login.png)]]

また、Pageantを使用して秘密鍵を自動的にロードすることも可能です。


== 次は?
 * [public_key 認証に公開鍵を利用する]
 * [ui_puttygen PuTTYgenの使い方]