vscode中ssh
时间: 2023-10-10 15:14:22 浏览: 100
使用VSCode和SSH进行远程开发
5星 · 资源好评率100%
在VSCode中使用SSH,可以通过以下步骤进行设置:
1. 首先,在终端中输入以下命令来检查SSH服务是否已经启动:
ssh service --status-all | grep ssh
2. 然后,在CMD或终端中执行以下内容来设置SSH密钥:
function ssh-copy-id([string]$userAtMachine, $args) {
$publicKey = "$ENV:USERPROFILE/.ssh/id_rsa.pub"
if (!(Test-Path "$publicKey")) {
Write-Error "ERROR: failed to open ID file '$publicKey': No such file"
} else {
& cat "$publicKey" | ssh $args $userAtMachine "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys || exit 1"
}
}
3. 最后,通过修改/etc/ssh/sshd_config文件来更改SSH的登录端口和禁止root登录。在修改前,可以先备份原始配置文件:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original
sudo chmod a-w /etc/ssh/sshd_config.original
vim /etc/ssh/sshd_config
以上就是在VSCode中使用SSH的设置步骤。通过这些设置,你可以使用SSH功能与远程服务器进行连接和操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [在VScode中使用SSH进行远程开发](https://blog.csdn.net/weixin_63268005/article/details/128231438)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [vscode通过ssh连接远程服务器中的容器](https://blog.csdn.net/weixin_42726887/article/details/121879598)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文