MacOS通过vscode远程连接服务器助力协同作业

目录

一、下载Remote-SSH并配置SSH信息

二、生成SSH的key并放置远程服务器上

1、首先生成ssh的key,这个教程有很多,例如:

RSA SSH keys

2、将生成的ssh key放置远程服务器,使用以下命令:


一、下载Remote-SSH并配置SSH信息

首先在Extension里面搜索Remote-SSH下载:

然后点击左下角绿色按钮进行SSH配置:

选择Open Configuration File。然后选择本机用户的ssh配置文件进行配置:

在配置文件最后面追加以下内容:

Host   服务器IP地址
    HostName   服务器IP地址
    User   用户名
    port   22

二、生成SSH的key并放置远程服务器上

1、首先生成ssh的key,这个教程有很多,例如:

RSA SSH keys

If you use RSA keys for SSH, the US National Institute of Standards and Technology recommends that you use a key size of at least 2048 bits. By default, the ssh-keygen command creates an 1024-bit RSA key.

You can create and configure an RSA key with the following command, substituting if desired for the minimum recommended key size of 2048:

ssh-keygen -t rsa -b 2048 -C "email@example.com"

The -C flag, with a quoted comment such as an email address, is an optional way to label your SSH keys.

You’ll see a response similar to:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):

2、将生成的ssh key放置远程服务器,使用以下命令:

ssh-copy-id your-user-name-on-host@host-fqdn-or-ip-goes-here
for example: ssh-copy-id root@172.0.0.1

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值