mac 使用termius 连接alibaba服务器

mac 使用termius 连接alibaba服务器

1、环境

  • Mac:本地
  • CentOS:8
  • Termius

2、操作

一下操作默认已有一台linux服务器,以及本地安装了Termius

  1. Linux服务器上生成一套密钥对
  2. Linux服务器上配置公钥
  3. Termius上配置私钥
  4. Termius使用私钥连接Linux服务器

3、步骤

先使用 Mac 自带的终端来连接服务器

  ssh 用户名@服务器 ip 地址 -> 回车  
  
  第一次连接的时候有可能会提示无法建立主机的真实性,是否继续,输入 yes -> 回车  
  
  密码 -> 回车  

生成密钥对

 ---
 
生成密钥
第一个询问,选择保存密钥的位置,一般默认好了,这里直接回车
第二个询问,是否给密钥设置一个密码,双重保险,如果需要直接输入,输入结束后回车
第三个询问,如果输入了密码,则会再次输入密码确认,输入结束后回车
 
---
 
[root@zwc ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which 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:
...具体密钥内容省略...
[root@zwc ~]#
 
---
 
查看密钥
 
---
 
[root@zwc .ssh]# cd ~/.ssh/
[root@zwc .ssh]# ls -all
总用量 16
drwx------  2 root root 4096 10月 12 16:54 .
dr-xr-x---. 9 root root 4096 10月  9 09:41 ..
-rw-------  1 root root    0 10月 11 10:19 authorized_keys
-rw-------  1 root root 1766 10月 12 16:54 id_rsa
-rw-r--r--  1 root root  390 10月 12 16:54 id_rsa.pub
[root@zwc .ssh]#   

Linux服务器上配置公钥

---
 
把公钥写入 authorized_keys 文件中
 
---
 
[root@zwc .ssh]# cd ~/.ssh/
[root@zwc .ssh]# ls -all
总用量 16
drwx------  2 root root 4096 10月 12 16:54 .
dr-xr-x---. 9 root root 4096 10月  9 09:41 ..
-rw-------  1 root root    0 10月 11 10:19 authorized_keys
-rw-------  1 root root 1766 10月 12 16:54 id_rsa
-rw-r--r--  1 root root  390 10月 12 16:54 id_rsa.pub
[root@zwc .ssh]# cat id_rsa.pub >> ~/.ssh/authorized_keys
[root@zwc .ssh]# cat ~/.ssh/authorized_keys 
...具体公钥内容省略...
[root@zwc .ssh]#

赋权限(关键)

---
 
赋权限
 
---
 
[root@zwc .ssh]# chmod 600 ~/.ssh/authorized_keys
[root@zwc .ssh]# ls -all
总用量 20
drwx------  2 root root 4096 10月 12 16:54 .
dr-xr-x---. 9 root root 4096 10月  9 09:41 ..
-rw-------  1 root root  390 10月 12 17:13 authorized_keys
-rw-------  1 root root 1766 10月 12 16:54 id_rsa
-rw-r--r--  1 root root  390 10月 12 16:54 id_rsa.pub
[root@zwc .ssh]#       

Termius 客户端配置私钥

0

0

0

回到 Terminal 复制私钥

---
 
复制私钥,注意要全部复制,包含 ...BEGIN... ~ ...END....
 
---
 
[root@zwc .ssh]# cat ~/.ssh/id_rsa
-----BEGIN RSA PRIVATE KEY-----
...具体私钥内容省略...
-----END RSA PRIVATE KEY-----
[root@zwc .ssh]# 

填写私钥信息

0

0

0

0

0

0

0

0

0

posted @   码出新生活!  阅读(444)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示