ssh-keygen
# +---[RSA 3072]----+
#| ..o.oo ..+.E |
#| .. +Ooo =o. |
#| ..@.=.++= |
#| B + +=+.. |
#| . . S+o. |
#| ..o =. |
#| .o +o |
#| o oo. |
#| oo... |
#+----[SHA256]-----+
cat id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVcH3IMTWETvQzELkuXwbEn+fKIEzVDGVh+FVY5jrc4ABwzdjSdvGuNYExCuiZAczg+U9+rEceaj8tOluMftoVG61pEfIDXdKZWYHny/5OfFWx3ist4AXxZuSuHFdSauOQXkvIO10RPHxLT4PDZpYXQg3mocy+e1jMpCeWBApEO83MUN3aD6SNZ4Zda729zl/qH/oyX1DghfNIc33RJ+XOWrgRmMMEp6JwXNunFCHUhlscuAYj2LSa2AV6wGZIjwyCJp20Fp0lcIvlINZ7pJzCOb6KCdZUTX38z8FV1z6TzBMvOBzO9XyfqXx42tPF3c7axviOHevsC1mfG5YtiMqyHPwF/AEyAK3SCIh9jLZ5NsWZzFxwxUs6FMMD7Ghh7rr2Q5CqpLDmPlOcCXr/Xp9nDGdSMnCVY3u/Rp2adPSavJe36JeyB4ezwzk4h1yTxcEk17tzfx35PAi+ta34cFLhENLVNlnCJRY+2W4Ce4h64CuYA+9IvpmC81ub+dWq0kM= ubuntu@ip-192-168-10-120
cd /home/ubuntu/.ssh
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVcH3IMTWETvQzELkuXwbEn+fKIEzVDGVh+FVY5jrc4ABwzdjSdvGuNYExCuiZAczg+U9+rEceaj8tOluMftoVG61pEfIDXdKZWYHny/5OfFWx3ist4AXxZuSuHFdSauOQXkvIO10RPHxLT4PDZpYXQg3mocy+e1jMpCeWBApEO83MUN3aD6SNZ4Zda729zl/qH/oyX1DghfNIc33RJ+XOWrgRmMMEp6JwXNunFCHUhlscuAYj2LSa2AV6wGZIjwyCJp20Fp0lcIvlINZ7pJzCOb6KCdZUTX38z8FV1z6TzBMvOBzO9XyfqXx42tPF3c7axviOHevsC1mfG5YtiMqyHPwF/AEyAK3SCIh9jLZ5NsWZzFxwxUs6FMMD7Ghh7rr2Q5CqpLDmPlOcCXr/Xp9nDGdSMnCVY3u/Rp2adPSavJe36JeyB4ezwzk4h1yTxcEk17tzfx35PAi+ta34cFLhENLVNlnCJRY+2W4Ce4h64CuYA+9IvpmC81ub+dWq0kM= ubuntu@ip-192-168-10-120" >> authorized_keys
ssh ubuntu@[Slave server IP]
cd /home/ubuntu/.ssh
cat id_rsa
sudo su
mkdir -p /var/lib/jenkins/.ssh
ssh-keyscan -H [Slave Server IP] >> /var/lib/jenkins/.ssh/known_hosts
sudo chown jenkins:jenkins /var/lib/jenkins/.ssh/known_hosts
sudo chmod 644 /var/lib/jenkins/.ssh/known_hosts
# sudo su
# root@ip-192-168-10-120:/home/ubuntu# mkdir -p /var/lib/jenkins/.ssh
# root@ip-192-168-10-120:/home/ubuntu# ssh-keyscan -H 192.168.20.254 >> /var/lib/jenkins/.ssh/known_hosts
# 192.168.20.254:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.20.254:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.20.254:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.20.254:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.20.254:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# root@ip-192-168-10-120:/home/ubuntu# sudo chown jenkins:jenkins /var/lib/jenkins/.ssh/known_hosts
# root@ip-192-168-10-120:/home/ubuntu# sudo chmod 644 /var/lib/jenkins/.ssh/known_hosts
# root@ip-192-168-10-120:/home/ubuntu# ssh-keyscan -H 192.168.30.26 >> /var/lib/jenkins/.ssh/known_hosts
# 192.168.30.26:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.30.26:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.30.26:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.30.26:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
# 192.168.30.26:22 SSH-2.0-OpenSSH_8.2p1 Ubuntu-4ubuntu0.7
Slave02 까지 Join 된 것을 확인!
여기서도 위에 했던 것 처럼 아래 명령어로 넣어줘야 한다.
ssh-keyscan -H [Slave Server IP] >> /var/lib/jenkins/.ssh/known_hosts