[root@localhost ~]# hostnamectl set-hostname master[root@localhost ~]# bash[root@master ~]# [root@localhost ~]# hostnamectl set-hostname node1[root@localhost ~]# bash[root@node1 ~]# [root@master ~]# echo "192.168.200.10 master" >> /etc/hosts[root@master ~]# echo "192.168.200.11 node1" >> /etc/hosts[root@master ~]# scp /etc/hosts root@node1:/etc/host
host.conf hostname hosts hosts.allow hosts.deny
[root@master ~]# scp /etc/hosts root@node1:/etc/hosts
The authenticity of host'node1 (192.168.200.11)' can't be established.
ECDSA key fingerprint is SHA256:ZJD5+SX9K5TIrhruYNsYjv8xCrndEXt4yrdCt077ejw.
ECDSA key fingerprint is MD5:bc:c9:43:fd:b0:19:f8:5e:15:a0:14:f2:ac:17:13:ff.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1,192.168.200.11' (ECDSA) to the list of known hosts.
root@node1's password:
hosts 100% 201267.3KB/s 00:00
[root@master ~]# ssh-keygen
Generating public/private rsa key pair.
Enter fileinwhich to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:I8nt/Be5ue9Rq2/u/zYvYCSgAQEHR15sYvwpIcFkqwE root@master
The key's randomart image is:
+---[RSA 2048]----+
|Eo***+. |
|..o==.+ . |
|. .o.= + . |
| o ..+o . . |
|. .+ S o . .|
| + . = ..|
| o . =.. |
| . + o+.|
| ...=B*O|
+----[SHA256]-----+
[root@master ~]# ssh-copy-id root@node1
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.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
root@node1's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@node1'"
and check to make sure that only the key(s) you wanted were added.
[root@master ~]# ssh root@node1
Last login: Sun Nov 1713:33:50 2024 from 192.168.200.1
[root@node1 ~]#