1.配置ntp服务器。2.SSH免密登录

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值