vscode遠程連接虛擬機
注意:在執行以下操作之前進去root權限
**
linux redhat8.4終端操作
**
1.linux中,安裝openssh
yum -y install openssh-server
2.查看安裝情況
systemctl list-unit-files | grep sshd.service
3.關閉防火墻
systemctl stop firewalld
4.修改檔案sshd_config
port 22(去掉#)
AddressFamily any (去掉#)
LoginGraceTime 2m
PermitRootLogin yes(將no改為yes)
PubkeyAuthentication yes(將no改為yes)
連不上的原因,很可能出現在該檔案的配置中,根據自己的情況進行修改
5.重啟ssh
systemctl restart sshd.service
systemctl status sshd(查看狀態)
systemctl stop sshd.service
systemctl start sshd.service
windows下vscode端操作
1.點擊
2.點擊open SSH Configuration File…

3.在打開的config檔案中添加如下
假設虛擬終端命名行顯示為:
No1@No2~
Host @后面的主機名No2
HostName 虛擬機ip地址(ifconfig查看)
User @前面的username No1
4.保存
5.最后再連接

選擇connect current window to Host…
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/347240.html
標籤:其他
