17
20

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 5 years have passed since last update.

簡単sshログイン方法

Posted at

#1.keyの作成

ターミナルで以下のコマンドで生成。

$ cd ~/.ssh
$ssh-keygen -t rsa -C test@example.com

これで

id_rsa		:秘密鍵
id_rsa.pub	:公開鍵

がそれぞれ生成される。
id_rsa.pubの情報をサーバに渡す。

#2.configの設定

sshログインを簡単にするためにconfigの設定

$ vim ~/.ssh/config

でコンフィグファイルを生成。内容は以下。

Host test //接続するサーバの名前(なんでもいい)
   HostName 000.00.0.000 //ホスト名
   User test //ユーザ名
   IdentityFile ~/.ssh/id_rsa //id_rsaが保存されてる場所
   Port 00000 //ポート番号

これで設定完了。

sshログインしたいときは

$ ssh test

Hostの追加はconfigを追加すればOK。
これでらくらくsshログイン。

17
20
1

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
17
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?