安装SSH服务并获取远程访问的IP地址
-
在Ubuntu系统中,打开终端工具,执行如下命令安装SSH服务。
说明: 如果执行该命令失败,提示openssh-server和openssh-client依赖版本不同,请根据CLI界面提示信息,安装openssh-client相应版本后(例如:sudo apt-get install openssh-client=1:8.2p1-4),再重新执行该命令安装openssh-server。
sudo apt-get install openssh-server shell
-
执行如下命令,启动SSH服务。
sudo systemctl start ssh shell
-
执行如下命令,获取当前用户的IP地址,用于Windows系统远程访问Ubuntu环境。
ifconfig shel
说明: 如果执行ifconfig命令提示“command-not-found”,请执行sudo apt-get install net-tools命令安装网络查询工具,然后重新查询IP地址。
安装Remote SSH
打开Windows系统下的Visual Studio Code,点击在插件市场的搜索输入框中输入“remote-ssh”。
点击Remote-SSH的Install,安装Remote-SSH。安装成功后,在INSTALLED下可以看到已安装Remote-SSH。