Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
visual studio 2019无法ssh到wsl ubuntu 18.04 我在通过Visual Studio 2019通过SSH连接到C++开发时遇到了一些问题。 Windows版本:10.0.18362内部版本18362。wsl上的ubuntu版本:ubuntu 18.04.4 LTS_Ubuntu_Ssh_Visual Studio 2019_Windows Subsystem For Linux - Fatal编程技术网

visual studio 2019无法ssh到wsl ubuntu 18.04 我在通过Visual Studio 2019通过SSH连接到C++开发时遇到了一些问题。 Windows版本:10.0.18362内部版本18362。wsl上的ubuntu版本:ubuntu 18.04.4 LTS

visual studio 2019无法ssh到wsl ubuntu 18.04 我在通过Visual Studio 2019通过SSH连接到C++开发时遇到了一些问题。 Windows版本:10.0.18362内部版本18362。wsl上的ubuntu版本:ubuntu 18.04.4 LTS,ubuntu,ssh,visual-studio-2019,windows-subsystem-for-linux,Ubuntu,Ssh,Visual Studio 2019,Windows Subsystem For Linux,我按照以下步骤设置ssh连接: 1-安装ssh服务器sudo apt安装openssh服务器 2-在/etc/ssh/sshd\u config处编辑配置文件。我的配置是: # $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more informati

我按照以下步骤设置ssh连接:

1-安装ssh服务器
sudo apt安装openssh服务器

2-在
/etc/ssh/sshd\u config
处编辑配置文件。我的配置是:

#   $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

Port 1478
#AddressFamily any
ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

# no default banner path
#Banner none

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

# override default of no subsystems
Subsystem   sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server
3-启动wsl上的ssh服务器
sudo服务ssh start

4-测试了putty和bitvise ssh的连接,所有的工作都很好,我可以ssh到ubuntu,并有一个终端和sftp会话。我还确保服务器通过powershell
netstat-an运行

5-转到visual studio工具->选项->跨平台->连接管理器->添加

我输入了putty和bitvise ssh中使用的相同主机、端口、用户和密码,但是我得到了一些延迟,没有发生任何事情,也没有显示任何错误,然后我再次单击连接,在主机和端口字段中得到一个错误,显示为:连接失败。请确保主机名和端口号正确。之后,所有的尝试都会导致相同的错误,即使我使用了错误的用户或密码

在第一次尝试时,我试图使用错误的用户或密码,但出现了一些延迟,用户和密码字段显示了一个错误,表示密码不正确。输入正确的凭据后,我再次获得第一个行为:延迟,什么也不发生,然后主机和端口错误

编辑:我启用了连接日志,得到:

21:19:14.5149607 [Info, Thread 1]   liblinux.RemoteSystemBase: Connecting over SSH to localhost:1478
21:19:15.9131254 [Info, Thread 1]   liblinux.IO.RemoteFileSystemImpl: Connecting over SFTP to localhost:1478
21:19:21.7184045 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "echo $0" finished with exit code 0 after 44.0724ms
21:19:21.7234275 [Info, Thread 1]   liblinux.TargetShell: Found shell 'bash' in use on '822733995'
21:19:21.8709831 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "cat /etc/os-release" finished with exit code 0 after 143.089ms
21:19:22.0309547 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "uname -m" finished with exit code 0 after 154.5144ms
21:19:22.1872648 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "uname -r" finished with exit code 0 after 150.4997ms
21:19:22.3497282 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "g++ -v" finished with exit code 0 after 119.5743ms
21:19:22.6425693 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "clang++ -v" finished with exit code 0 after 286.7829ms
21:19:22.7933986 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "gdbserver --version" finished with exit code 0 after 143.7903ms
21:19:22.9545787 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "gcc -v" finished with exit code 0 after 154.3292ms
21:19:23.4517720 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "gdb -v" finished with exit code 0 after 489.7793ms
21:19:24.1040235 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "/usr/bin/gdb -v" finished with exit code 0 after 643.8794ms
21:19:24.2484893 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "/usr/local/bin/gdb -v" finished with exit code 127 after 134.6787ms
21:19:24.4071410 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "rsync -v" finished with exit code 1 after 153.1007ms
21:19:25.0386960 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "lldb -v" finished with exit code 0 after 623.3945ms
21:19:25.2065987 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "ninja --version" finished with exit code 0 after 161.349ms
21:19:25.5204182 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "cmake --version" finished with exit code 0 after 305.7367ms
21:19:25.7033145 [Info, Thread 1]   liblinux.Shell.CommonCommandBase: Command "make -v" finished with exit code 0 after 173.4825ms
21:19:40.9288082 [Info, Thread 1]   liblinux.RemoteSystemBase: Disconnecting over SSH from "localhost:1478"
21:19:40.9441152 [Info, Thread 1]   liblinux.IO.RemoteFileSystemImpl: Disconnecting over SFTP from localhost:1478

我没有通过visual studio IDE添加连接,所以我使用了ConnectionManager.exe工具。起初我得到了一个错误,因为日期是阿拉伯语,但在我更改了日期后,连接被成功添加