赞
踩
1.
[root@bogon ~]# vim /etc/chrony.conf
[root@bogon ~]# systemctl restart chronyd
[root@bogon ~]# vim /etc/chrony.conf
[root@bogon ~]# systemctl restart chronyd
[root@bogon ~]# chronyc sources -v
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current best, '+' = combined, '-' = not combined,
| / 'x' = may be in error, '~' = too variable, '?' = unusable.
|| .- xxxx [ yyyy ] +/- zzzz
|| Reachability register (octal) -. | xxxx = adjusted offset,
|| Log2(Polling interval) --. | | yyyy = measured offset,
|| \ | | zzzz = estimated error.
|| | | \
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
[root@bogon ~]# date
2.客户端
[root@bogon ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:S6SCOGDA/whZnFJE2HP7ZL32PjRiLRlq0YrNnHVqNgY root@bogon
The key's randomart image is:
+---[RSA 3072]----+
|o B+. |
|.+ * . |
|..= o . + |
|o+ o . E = . |
|o o + X S B |
| . . + @ # + |
| . B * . |
| o |
| ... |
+----[SHA256]-----+
[root@bogon ~]# cd /root/.ssh
[root@bogon .ssh]# ll
总用量 8
-rw-------. 1 root root 2590 3月 25 23:28 id_rsa
-rw-r--r--. 1 root root 564 3月 25 23:28 id_rsa.pub
[root@bogon .ssh]# cat id_rsa.pub >>authorized_keys
[root@bogon ~]# systemctl restart sshd
[root@bogon ~]# ssh localhost
The authenticity of host 'localhost (::1)' can't be established.
ED25519 key fingerprint is SHA256:o2dLOzUvfc3/R2LN9ZzBjLk/O9+DiZUzKvYY7rH+jPk.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'localhost' (ED25519) to the list of known hosts.
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Mar 25 22:17:03 2023
[root@bogon ~]# ssh-copy-id 192.168.150.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.150.129 (192.168.150.129)' can't be established.
ED25519 key fingerprint is SHA256:o2dLOzUvfc3/R2LN9ZzBjLk/O9+DiZUzKvYY7rH+jPk.
This host key is known by the following other names/addresses:
~/.ssh/known_hosts:1: localhost
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/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@192.168.150.129's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.150.129'"
and check to make sure that only the key(s) you wanted were added.
[root@bogon ~]# ssh 192.168.150.129
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Mar 25 22:24:00 2023
服务端
[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'.
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:GyahUlmtG0GWVtguaVR/zM8PInHS1HXFWRgvEnmY/1c root@localhost.localdomain
The key's randomart image is:
+---[RSA 3072]----+
| .+Bo o=.=O|
| +* o. =+.+oo|
| oo.= + Bo. .|
| . .*.. = +..E|
| . ...+S . . +..|
| . .o o . . oo|
| . o|
| |
| |
+----[SHA256]-----+
[root@localhost ~]# cd /root/.ssh
[root@localhost .ssh]# ll
总用量 8
-rw-------. 1 root root 2610 3月 25 23:33 id_rsa
-rw-r--r--. 1 root root 580 3月 25 23:33 id_rsa.pub
[root@localhost .ssh]# cat id_rsa.pub >>authorized_keys
[root@localhost .ssh]# chmod u=rw,go-rwx authorized_keys
[root@localhost .ssh]# systemctl restart sshd
[root@localhost .ssh]# cd
[root@localhost ~]# systemctl restart sshd
[root@localhost ~]# ssh-copy-id 192.168.150.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.150.129 (192.168.150.129)' can't be established.
ED25519 key fingerprint is SHA256:o2dLOzUvfc3/R2LN9ZzBjLk/O9+DiZUzKvYY7rH+jPk.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/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: WARNING: All keys were skipped because they already exist on the remote system.
(if you think this is a mistake, you may want to use -f option)
[root@localhost ~]# ssh 192.168.150.129
Activate the web console with: systemctl enable --now cockpit.socket
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Mar 25 23:47:58 2023 from 192.168.150.128
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。