Jetbrains远程开发配置-Webstrom

发布于 2025年07月13日

场景

由于代码同步比较麻烦,又习惯了使用windows系统,但是在windows上很多环境安装都非常麻烦,所以就想到了在虚拟机里面进行代码开发,因为使用密码的远程,很容易掉线,所以我们采用ssh密钥的方式,这种方式非常稳定。

准备材料

  • webstorm
  • ubuntu虚拟机

创建ssh密钥并连接

创建密钥:

ubuntu@ubuntu:~$ ssh-keygen
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_ed25519): 

出现这个提示,直接一路回车即可,出现以下提示就是成功创建了。

ubuntu@ubuntu:~$ ssh-keygen
Generating public/private ed25519 key pair.
Enter file in which to save the key (/home/ubuntu/.ssh/id_ed25519): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/ubuntu/.ssh/id_ed25519
Your public key has been saved in /home/ubuntu/.ssh/id_ed25519.pub
The key fingerprint is:
SHA256:pZ5CHa66S54siHukLVfA7pSx7Xz1JgSSpQxjqbqyUNQ ubuntu@ubuntu
The key's randomart image is:
+--[ED25519 256]--+
|   .             |
|  =.  .          |
| +.+E+  . .      |
|..+ = .o +       |
|...* ...S        |
|..* o. oo.       |
|oO +. ooo.       |
|O *+oo... o      |
|+* .B+   o       |
+----[SHA256]-----+
ubuntu@ubuntu:~$ 

仔细看提示,已经成功保存到/home/ubuntu/.ssh/id_ed25519.pub,id_ed25519

接下来把公钥写到登录认证里面,一定要是.pub结尾的文件:

cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys

设置文件权限:
确保 .ssh 目录和 authorized_keys 文件的权限正确:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

修改SSH配置

为了更高的安全性,可以修改 SSH 配置文件:
编辑 /etc/ssh/sshd_config 文件:

sudo vim /etc/ssh/sshd_config

确保 PubkeyAuthentication 是开启的:

PubkeyAuthentication yes

esc保存后退出::wq,然后重启ssh即可

sudo systemctl restart ssh

下载保存linux主机的私钥

路径:/home/ubuntu/.ssh/id_ed25519,保存到你自己喜欢的目录。

启动webstorm远程连接



评论