Security/ssh
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#x5ab1185]
#contents();
/////////////////////////////////////////////////////////...
* sshキー [#ssh-key]
//=======================================================...
** sshキーの生成 [#ssh-key-gen]
$ ssh-keygen -t ed25519 -C account@hostname
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/account/.ssh/...
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/account/.ssh...
Your public key has been saved in /home/account/.ssh/id_...
The key fingerprint is:
SHA256:6rp4b8YlVK5k8auztiFK5QuZsjQIRCf5yFBrkUS50Xg accou...
The key's randomart image is:
+--[ED25519 256]--+
| *** |
|o.BoE . . |
|o.=+ = |
|.+.. + o |
|. .+ .S. |
|o = o.o |
|oo= o.o+ |
|.+.+.+B. |
|. o.+B=+ |
+----[SHA256]-----+
$
- -t オプション
-- 指定しなければ、 default で RSA が選択される
-- ed25519 は、Ed25519 アルゴリズムを指定するもの。これは...
/////////////////////////////////////////////////////////...
* 公開鍵認証の設定 [#v5e2575a]
+ ローカルにて
-- ssh キーを ~/.ssh/authorized_keys に登録する
[user@exaple.com:0 .ssh]$ ssh-copy-id user@exaple.com
/usr/bin/ssh-copy-id: INFO: attempting to log in with th...
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be instal...
user@exaple.com's password:
Permission denied, please try again.
user@exaple.com's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'user@exa...
and check to make sure that only the key(s) you wanted w...
//=======================================================...
** ssh-agent / ssh-add [#s2cd56ab]
- ssh-agent と ssh-add を用いてセッションを維持し、そこで...
$ ssh-agent bash
$ ssh-add ~/.ssh/<ssh-key-file>
Enter passphrase for ${HOME}/.ssh/<ssh-key-file>:
Identity added: ${HOME}/.ssh/<ssh-key-file> (${HOME}/.ss...
$
/////////////////////////////////////////////////////////...
* ssh で接続できないとき [#t97f89a4]
+ デバッグモードで接続してみる
$ ssh -vvv ${REMOTE_HOST}
+ ログを見てみる(要管理者権限)
$ less /var/log/auth.log
/////////////////////////////////////////////////////////...
* ssh による無認証ログイン [#q3395abd]
//=======================================================...
** 環境設定 [#ma454f6a]
+ [[sshキーの生成>#ssh-key-gen]] で生成したキーのうち、公...
+ 接続先サーバにログインし、配置した公開鍵を登録する。
$ ssh-copy-id -i ~/.ssh/<public-key-file>.pub <user@host>
+ (上記が終わったら、サーバからはログアウトする。)
//=======================================================...
** 接続 [#w8ea9605]
+ 接続先サーバに ssh 接続する。初回はパスワードを訊かれる...
$ ssh <user@host>
/////////////////////////////////////////////////////////...
* 明示的にパスワード認証ログインする [#r4b86a0c]
- コマンド書式は下記
$ ssh <user>@<remote-host> -o PreferredAuthentications=p...
/////////////////////////////////////////////////////////...
* Links [#b112913e]
終了行:
#topicpath
/////////////////////////////////////////////////////////...
* 目次 [#x5ab1185]
#contents();
/////////////////////////////////////////////////////////...
* sshキー [#ssh-key]
//=======================================================...
** sshキーの生成 [#ssh-key-gen]
$ ssh-keygen -t ed25519 -C account@hostname
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/account/.ssh/...
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/account/.ssh...
Your public key has been saved in /home/account/.ssh/id_...
The key fingerprint is:
SHA256:6rp4b8YlVK5k8auztiFK5QuZsjQIRCf5yFBrkUS50Xg accou...
The key's randomart image is:
+--[ED25519 256]--+
| *** |
|o.BoE . . |
|o.=+ = |
|.+.. + o |
|. .+ .S. |
|o = o.o |
|oo= o.o+ |
|.+.+.+B. |
|. o.+B=+ |
+----[SHA256]-----+
$
- -t オプション
-- 指定しなければ、 default で RSA が選択される
-- ed25519 は、Ed25519 アルゴリズムを指定するもの。これは...
/////////////////////////////////////////////////////////...
* 公開鍵認証の設定 [#v5e2575a]
+ ローカルにて
-- ssh キーを ~/.ssh/authorized_keys に登録する
[user@exaple.com:0 .ssh]$ ssh-copy-id user@exaple.com
/usr/bin/ssh-copy-id: INFO: attempting to log in with th...
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be instal...
user@exaple.com's password:
Permission denied, please try again.
user@exaple.com's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'user@exa...
and check to make sure that only the key(s) you wanted w...
//=======================================================...
** ssh-agent / ssh-add [#s2cd56ab]
- ssh-agent と ssh-add を用いてセッションを維持し、そこで...
$ ssh-agent bash
$ ssh-add ~/.ssh/<ssh-key-file>
Enter passphrase for ${HOME}/.ssh/<ssh-key-file>:
Identity added: ${HOME}/.ssh/<ssh-key-file> (${HOME}/.ss...
$
/////////////////////////////////////////////////////////...
* ssh で接続できないとき [#t97f89a4]
+ デバッグモードで接続してみる
$ ssh -vvv ${REMOTE_HOST}
+ ログを見てみる(要管理者権限)
$ less /var/log/auth.log
/////////////////////////////////////////////////////////...
* ssh による無認証ログイン [#q3395abd]
//=======================================================...
** 環境設定 [#ma454f6a]
+ [[sshキーの生成>#ssh-key-gen]] で生成したキーのうち、公...
+ 接続先サーバにログインし、配置した公開鍵を登録する。
$ ssh-copy-id -i ~/.ssh/<public-key-file>.pub <user@host>
+ (上記が終わったら、サーバからはログアウトする。)
//=======================================================...
** 接続 [#w8ea9605]
+ 接続先サーバに ssh 接続する。初回はパスワードを訊かれる...
$ ssh <user@host>
/////////////////////////////////////////////////////////...
* 明示的にパスワード認証ログインする [#r4b86a0c]
- コマンド書式は下記
$ ssh <user>@<remote-host> -o PreferredAuthentications=p...
/////////////////////////////////////////////////////////...
* Links [#b112913e]
ページ名: