- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 943
Troubleshooting SSH.NET
If you encounter problems using the library, use this page as a reference on how to try find the source of the problem.
Please ensure you are using the latest release of SSH.NET. If you are already using the latest release, then download and compile the latest source code. Don't forget to update your project(s) reference(s).
#Table of Contents#
- Template for submitting an issue report
- How to narrow your problem down
- Frequently experienced SSH.NET exceptions
- System.Net.Socket exceptions
- NET TraceSource and TraceListeners
- SSH server assisted troubleshooting
- Log files
- Debugging mode
1. Debug level
1. Foreground process - Unsupported remote systems
- Watchguard Firewall
#Template for submitting an issue report# Before you submit an issue report, please ensure you are using the latest release of SSH.NET. If you are already using the latest release, then download and compile the latest source dode. Don't forget to update your project(s) reference(s).
Additionally, try to narrow down the problem by creating a very simple example that reproduces the problem you have. This is an important step, because it will eliminate most issues relating from other code that might influence the behavior of SSH.NET.
Please use this template when submitting a new issue report. It will provide the necessary details for a more precise understanding of the problem you have.
Just copy everything between the 2 lines and paste them into the description of the issue.
Remote Server Information
Remote SSH Server version:
Remote Operating System distribution name and architecture (x32/x64):
What kind of access do you have?:
Does Putty/WinSCP work?:
Local Machine Information
Operating System (for Windows, run winver.exe):
.NET Framework versions installed (See C:\WINDOWS\Microsoft.Net\Framework):
Project information
What is your target framework and architecture (x32/x64)?:
Is your project multi-threaded/complex?:
Source Code
Sample Code:
Exceptions and Stack Trace/Call Stack:
File transfer related
Transfer over LAN or Internet?:
File size in bytes:
Uploading or Downloading?
Does remote server have enough space to store the file?
Do you have access to the file being uploaded or downloaded?
##How to narrow your problem down##
By creating the simplest possible code that reproduce the problem you are having, it will be easier to debug and to pinpoint exactly where and why the problem is happening. So take some time to create code that can reproduce the problem.
###Frequently experienced SSH.NET exceptions###
"Key exchange negotiation failed"
The client and the server cannot find a common algoritm for exchanging keys.
To find out what kind of algorithms the server supports, you can put a breakpoint in the Start(Session, KeyExchangeInitMessage)
method in Security\KeyExchange.cs.
"No suitable authentication method found to complete authentication."
The server is expecting a password/key authentication, but the client is sending a key/password, or an authentication mechanism that is not commonly supported by both client and server.
###System.Net.Socket exceptions###
Sometimes the server doesn't know what to do, and it just closes the connection and you'll get An existing connection was forcibly closed by the remote host exception.
If you get any of the following exception descriptions, it might be a problem on the computer you are running the program from, or the network you are on, and you should try your program on a different computer and network:
- A blocking operation was interrupted by a call to WSACancelBlockingCall
- Connection was lost
- A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied
###.NET TraceSource and TraceListeners###
SSH.NET contains some tracing functionality, but at the time of writing, this is very limited.
The XML samples here should be put in the application configuration file under the configuration -> system.diagnostics element.
The samples here are based on samples posted in Durgaprasad Gorti's WebLog at Using System.Net Tracing
System.Net.Sockets
The System.Net.Sockets namespace has some tracing options, this is how you enable it.