|
# 鍵ペア作成
suse@client:~> ssh-keygen
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/suse/.ssh/id_ed25519): # 変更の必要がなければ空 Enter
Enter passphrase for "/home/suse/.ssh/id_ed25519" (empty for no passphrase): # パスフレーズ設定 (ノーパス設定にする場合は空 Enter)
Enter same passphrase again:
Your identification has been saved in /home/suse/.ssh/id_ed25519
Your public key has been saved in /home/suse/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:ny6OmUMBZseqZPOP1BSumeZu4hmWvMSMpLNPq91ofu4 suse@client.srv.world
The key's randomart image is:
.....
.....
suse@client:~>
total 16
-rw-------. 1 suse suse 464 Oct 15 10:36 id_ed25519
-rw-r--r--. 1 suse suse 103 Oct 15 10:36 id_ed25519.pub
-rw-------. 1 suse suse 837 Oct 15 10:10 known_hosts
-rw-r--r--. 1 suse suse 95 Oct 15 10:10 known_hosts.old
# 作成した SSH 公開鍵を ログインしたいサーバーへコピー
suse@client:~> ssh-copy-id dlp.srv.world
usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/suse/.ssh/id_ed25519.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
(suse@dlp.srv.world) Password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'dlp.srv.world'"
and check to make sure that only the key(s) you wanted were added.
# 公開鍵をコピーしたサーバーへ鍵認証でログインできるか確認
suse@client:~> ssh dlp.srv.world hostnamectl
nter passphrase for key '/home/suse/.ssh/id_ed25519': # パスフレーズを設定した場合は入力
Static hostname: dlp.srv.world
Icon name: computer-vm
.....
.....
|