Mac 配置与 Linux 通讯

Mac 配置与 Linux 通讯 1. 安装 sh-copy-id sudo curl -L https://raw.g…

Mac 配置与 Linux 通讯

Mac 配置与 Linux 通讯-1

1. 安装 sh-copy-id

sudo curl -L https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/install.sh | sh

 

或者

brew install ssh-copy-id

 

2. 生成登录公钥私钥对

$ ssh-keygen -o -t rsa -C “[email protected]” -b 4096

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/zongxun/.ssh/id_rsa):

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /Users/zongxun/.ssh/id_rsa

Your public key has been saved in /Users/zongxun/.ssh/id_rsa.pub

The key fingerprint is:

SHA256:ewAVKPAGTO/lI+lE2VwUDThKV2xoSY8JINGqTGDleMY [email protected]

The key’s randomart image is:

+—[RSA 4096]—-+

|o=*+…OO=       |

|.o*+o=O*o .      |

|oo E*=Bo.        |

|..o+.+ .         |

|+   = o S        |

|.. o . . o       |

|    .   . .      |

|         .       |

|                 |

+—-[SHA256]—–+

➜  ~ cat /Users/zongxun/.ssh/id_rsa.pub

 

3. 拷贝公钥到远程主机

~ cat /Users/zongxun/.ssh/id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCtWnPklKrtkQ9tWm68M+YOLgJBOr4NFI8u4KVGEY+SZS2WjYOjc1A/4at8ccal2xyd0ajH8ytiXgW5q1ngCYgM3QBOoZ6Wenq6FEWwRR9o7Txwf+0d2Y1/goRfYEJ+S940ErrIyb5KCEJFOvnu5DwoJTULolel1+gxYWAyJdhnCCJbB9KHuMTwcVDRpkz4tGQHMgyq8JthpJcUTqeIG/jwmEioVapm9llcOJIFCmaGkO7HOSdH5CczMqT6WndXWx2TtOlUxXggPBqkKi3yqm21XPz1Ent5Lfgl0PNfamGHU6Znm3RViZl8Q8A3yoZlLS8o7ca4P8gT9VIcYwxPzs7sdQvr6wur65YTJFTpE95lUUGZNbCTj/2ZBvX54Yiosd5kQ9U/6zh66LLilagBOx7OtRHex9LIxrRuUWDqBewjvZSERY5/ZylOYQ6KX+xC1GgkOhF2giOqtQxS7Q4ORF9czIdvmSeI0TQKQIsxcIaebiwaI2FLzE+FNDdO8imHV9rPNN+wuu2T9/LkemquQAnhDlGXQzszB/Nvzv0BDjHv+TsbOvFVUdB6VRevlz+c6tSvhJXDY/fluAYnl6yBK12X34PFhUta8K+QVxq/TAOmE9ZJZosp96Pa3abHxW2I7BbVajon94V/dU66d+osbuTXuQ/rjIaWy55nZOzi9QVlkw== [email protected]

➜  ~ ssh-copy-id [email protected]

/opt/homebrew/opt/ssh-copy-id/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/Users/zongxun/.ssh/id_rsa.pub”

/opt/homebrew/opt/ssh-copy-id/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/opt/homebrew/opt/ssh-copy-id/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys

[email protected]’s password:

 

Number of key(s) added:        1

 

Now try logging into the machine, with:   “ssh ‘[email protected]′”

and check to make sure that only the key(s) you wanted were added.

 

4. 访问远程主机

➜  ~ ssh [email protected]

Activate the web console with: systemctl enable –now cockpit.socket

 

Last login: Thu Mar  2 14:56:56 2023 from 172.7.245.44

[root@kind2 ~]#

为您推荐

创建swap分区提示:swapon 失败: 无效的参数

服务器在安装系统时未分配swap分区,因生产环境需要swap支持,需要手动对系统创建swap分区。 我在创建swap分区...

Centos7 系统开通后修改数据盘挂载目录

云服务器开通后,数据盘 /dev/vdb1 默认挂载在 /www1 目录,通常这个目录不是我们需要的。 比如安装宝塔面板...

CentOS系统修改网卡em1为eth0

部分Dell服务器在安装Linux操作系统之后,发现网卡名称变成em1了。 解决办法: 修改网卡名称为eth0,这里以C...

通过iptables 实现端口转发

要求:访问本机3389端口,转发到目标机器3389端口,实现转发远程。 机器环境:本机:192.168.1.1    目...

Centos8 无法yum安装软件?

错误提示: 错误:Failed to download metadata for repo ‘AppStre...
返回顶部