Mac配置与Linux通讯

Mac 配置与 Linux 通讯

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 "1zoxun1@gmail.com" -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 1zoxun1@gmail.com

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== 1zoxun1@gmail.com

➜  ~ ssh-copy-id root@192.168.10.29

/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

root@192.168.10.29's password:

Number of key(s) added:        1

Now try logging into the machine, with:   "ssh 'root@192.168.10.29'"

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

4. 访问远程主机

➜  ~ ssh root@192.168.10.29

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 ~]#

当前名称:Mac配置与Linux通讯
网站链接:http://www.shufengxianlan.com/qtweb/news45/428045.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联