设置windows SSH 到linux时免密码登录的方法:
将C:\Users\Administrator\.ssh\id_rsa.pub中的公钥字符串复制,追加到linux ~/.ssh/authorized_keys文件中。
问题:
root@localhost:~/.vscode-server/bin/6261075646f055b99068d3688932416f2346dd3b# wget https://vscode.cdn.azure.cn/stable/6261075646f055b99068d3688932416f2346dd3b/vscode-server-linux-x64.tar.gz Error parsing proxy URL socks5://172.xx.xx.xx:10808: Unsupported scheme ‘socks5’.
原因:
设置了http_proxy SOCK5不支持
临时置为空:
在shell中执行
export http_proxy=
export https_proxy=
问题:
ssh插件安装后,点+号,进行远程连接,输入ssh root@192.168.4.100 -A后,添加到config文件中,但接下来没看到连接的按钮。
解决: 点+加号旁边的刷新符号,即可看到。
问题:
Could not establish connection to : XHR failed. 或者
一直不停的让输入密码,又打印断开。Install terminal quit with output:
解决:
删除windows的.ssh/known_hosts中的目标机器(linux)IP对应的这一条信息。
位置:C:\Users\Administrator\.ssh
复制代码
问题:安装VS Code Server失败,一直处于尝试安装中
解决: 手动来下载,下载配置好之后,检测到有相应的东西,vscode就会跳过下载直接启动远程的终端及相应线程 。
VSCODE窗口--菜单栏--帮助--关于--弹窗中找到commit_id,点击复制,另一种方法是“VS Code Server失败,一直处于尝试安装中”时,在VSCODE的REMOTE SSH的OUTPUT中查看到有信息:
[16:33:53.029] Using commit id "6261075646f055b99068d3688932416f2346xxxx" and quality "stable" for server [16:33:53.033] Install and start server if needed
以上的6261075646f055b99068d3688932416f2346xxxx即为我当前版本的commit_id
预先创建文件夹
mkdir -p ~/.vscode-server/bin/6261075646f055b99068d3688932416f2346xxxx
进入到文件夹并下载依赖
cd ~/.vscode-server/bin/6261075646f055b99068d3688932416f2346dd3b wget https://vscode.cdn.azure.cn/stable/6261075646f055b99068d3688932416f2346xxxx/vscode-server-linux-x64.tar.gz
tar zxvf vscode-server-linux-x64.tar.gz --strip 1 #这个命令尤其重要否则会不成功 touch ~/.vscode-server/bin/6261075646f055b99068d3688932416f2346xxxx/0
问题:
Remote-SSH hangs on "Setting up SSH Host Initializing VS Code Server" 解决方法:
重连, 然后点击上面的Linux(连接方式),这一步操作很重要,如果没找到就断开连接再试试。
问题:
远程调试,先在linux上启动gdbserver (要安装),启动命令
gdbserver --attach localhost:8081 110485
在vscode中,看到c/c++插件是灰色的,提示远程不可用
VsCode找不到类型为 “cppdbg“ 的调试适配器。
复制代码
解决:
在vscode点击不可用的插件,在插件详细页面看到有install SSH:XXXXXX , 点击它,安装到目标机器上即可。
然后就可在底下工具栏中点击启动调试了
问题:
[14:39:35.111] Got some output, clearing connection timeout
[14:39:35.265] >
[14:39:35.274] > 12d858e1dc4e: running
>
[14:39:35.283] > Acquiring lock on /root/.vscode-server/bin/e8a3071ea4344d9d48ef8a4df2c097372b0c5
> 161/vscode-remote-lock.root.e8a3071ea4344d9d48ef8a4df2c097372b0c5161
> Installation already in progress...
> If you continue to see this message, you can try toggling the remote.SSH.useFloc
> k setting
> 12d858e1dc4e: start
> exitCode==24==
> listeningOn====
> osReleaseId==centos==
> arch==x86_64==
> tmpDir==/run/user/0==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> 12d858e1dc4e: end
>
[14:39:35.283] Received install output:
exitCode==24==
listeningOn====
osReleaseId==centos==
arch==x86_64==
tmpDir==/run/user/0==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
[14:39:35.283] Server installation process already in progress - waiting and retrying
[14:39:35.370] "install" terminal command done
[14:39:35.371] Install terminal quit with output:
[14:39:36.285] Resolver error: Error:
at g.Create (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.94.0\out\extension.js:1:583926)
at c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.94.0\out\extension.js:1:643273
at async t.withShowDetailsEvent (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.94.0\out\extension.js:1:646166)
at async t.resolve (c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.94.0\out\extension.js:1:643898)
at async c:\Users\Administrator\.vscode\extensions\ms-vscode-remote.remote-ssh-0.94.0\out\extension.js:1:723024
[14:39:36.290] ------
[14:39:36.678] "install" terminal command done
[14:39:36.680] Install terminal quit with output:
原因:
下载安装server配置失败
解决方法(ID取决于vscode版本):
mkdir -p ~/.vscode-server/bin/e8a3071ea4344d9d48ef8a4df2c097372b0c5161
cd ~/.vscode-server/bin/e8a3071ea4344d9d48ef8a4df2c097372b0c5161
wget https://vscode.cdn.azure.cn/stable/e8a3071ea4344d9d48ef8a4df2c097372b0c5161/vscode-server-linux-x64.tar.gz
mv vscode-server-linux-x64/* .
touch 0
然后在vscode中重新ssh连接试试。
linux机器上安装gdb-gdbserver
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "myprogram",
"type": "cppdbg",
"request": "launch",
"program": "/usr/local/mytest/myprogram",
"args": [],
"stopAtEntry": false,
"cwd": "/usr/local/mytest/",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"miDebuggerServerAddress":"172.20.0.xx:12345"
}
]
}
查看myprogram的PID,假设PID为3066,则启动gdbserver如下
gdbserver --attach 172.20.0.116:12345 3066
然后vscode的debug中,添加好launch.json后,点击左上角播放按钮(三角形),就会detach到目标程序myprogram上。