1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

コマンドプロンプトで秘密鍵を作りサーバーにアクセス

Last updated at Posted at 2021-06-17

概要

Windowsのコマンドプロンプトで秘密鍵と公開鍵を作成し,
コマンドプロンプトのSSHクライアントを使ってサーバーにアクセスする

公開鍵と秘密鍵の作成

Windowsのコマンドプロンプトを起動.
(画面左下の検索窓から"cmd"もしくは,"コマンド"と検索すれば表示される)
作成場所を聞かれるので,変更する場合は場所のパスを,そのままの場合はEnter.
パスフレーズを聞かれるので,入力.(入力しなくても作成できるが,セキュリティ的には作成した方が良い)

$ ssh-keygen -t rsa -b 2048
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\stars/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):

指定したディレクトリに,id_rsaとid_rsa.pubが作成される.(この例では,C:\Users\stars/.ssh/)
id_rsa.pubをサーバーの管理者へ渡す.
id_rsaは,厳重に管理する.(流出するなどした場合は,作り直すこと)

サーバーへのアクセス

管理者にサーバーを設定してもらったら,コマンドプロンプトからSSHでアクセスできるようになる.

$ ssh <サーバーのユーザ名>@<サーバーのIPアドレス>

例えば,下記のように

$ ssh fuga@192.168.11.1
1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?