Questions tagged [ssh.net]

SSH.NET is an open-source .NET port of the Java Sharp.SSH library and is available under the BSD and MIT license.

1
vote
0answers
51 views

How to connect SSH.NET in MongoDB C#

I'm using this SSH.NET client https://github.com/sshnet/SSH.NET/ and MongoDB C# latest client. As per https://jira.mongodb.org/browse/CSHARP-1142 i'm trying to inject SSHStream into MongoDB Client ...
1
vote
2answers
91 views

Run and execute multiple dependent SSH commands using C#

I want to change directory inside SSH using C# with SSH.NET library: SshClient cSSH = new SshClient("192.168.80.21", 22, "appmi", "Appmi"); cSSH.Connect(); Console.WriteLine("current directory:"); ...
1
vote
1answer
50 views

How can I limit the upload speed with SSH.NET?

I'm using SSH.NET in C#. I'd like to limit the upload speed when using SftpClient.UploadFile. Is there a way to do that? FileStream stream = new FileStream(strLocalFileName, FileMode.Open, ...
0
votes
0answers
35 views

Cannot connet to sftp server from windows service

I'm working on windows service that uploads files to sftp server using SSH.NET. Problem is when I run code responsible for sending file from windows console app everything works fine, but when exact ...
0
votes
1answer
55 views

Getting 'No such file' error when trying to download a file with Renci.SshNet using SftpClient

It works when I download a file from another server. I can delete files and get a directory list but I cannot download the file. The only exception I get is 'No such file', even when I use a file ...
1
vote
2answers
149 views

Cannot connect to SSH/SFTP server with VB.NET and SSH.NET – but WinSCP and FileZilla can connect

For years the code below has worked. Then on April 11th it stopped. I noticed a warning in Visual Studio that the SSH.NET package was out of date, so I updated the package... still doesn't work. ...
1
vote
1answer
93 views

Upload file uploaded via HTTP to ASP.NET further to SFTP server in C# and SSH.NET

I'm setting up a file transfer through Renci SSH.NET library using SFTP and C#. And I'm stuck on this problem. Whenever I upload a file in my ASP .NET Core program it sends the file, but it sends it ...
-1
votes
1answer
47 views

How to write formatted JSON to text file using ssh.net?

I am writing a c# object as JSON to text file which is on SFTP server using ssh.net. I am able to write it but double quotes are getting removed from Json property, How to persist it? using (var ...
-1
votes
1answer
36 views

How to write content to file on linux SFTP server using SshClient?

I am dealing with Linux SFTP server using .Net (SshClient) code, so I am creating folder on SFTP server and creating files also. For this I am using following code, using (var client = new SshClient(...
0
votes
0answers
36 views

How to caluclate Sha256 hash for a sftp file? [duplicate]

My code downloads files from a SFTP server, while downloading i want to caluclate Sha256 hash code for the file i am about to download. So that i wont download duplicate file. I am currently using ...
3
votes
1answer
409 views

“Renci.SshNet.Common.SshException: Invalid private key file” when loading SSH private key from configuration string using SSH.NET

I'm trying to send a file to some server using SFTP. During this process I'm getting the exception Renci.SshNet.Common.SshException: Invalid private key file. at Renci.SshNet.PrivateKeyFile.Open(...
-1
votes
1answer
94 views

How to connect to remote SFTP server from OpenShift .NET Core POD using SSH.NET

I have a .NET Core 2.2 service running in OpenShift. My service uses SSH.NET to connect to my remote SFTP Server running outside the OpenShift cloud. The SFTP server is configured to provide only SFTP ...
1
vote
0answers
30 views

Use a new ssh connection using another established connection with SSH.NET [duplicate]

I have a target computer which can be accessed only with SSH, I do not have a direct connection, so I need to connect through another SSH machine. Until now, I connect with putty (SSH) to machine A ...
1
vote
1answer
45 views

Responding to command prompts in SSH.NET

I want to interrupt my output logging thread to "confirm" an action. For example I want to install php, so I type sudo apt-get install php. Than I have to confirm that with a y, i know that I can ...
0
votes
1answer
197 views

C#-Renci.Ssh.Net- UploadFile SFTP- Verify if File Uploaded Successfully

I am using Renci.Ssh.Net to upload file at SFTP location. using (SftpClient client = new SftpClient(host, port, sftpUser, sftpPassword)) { client.Connect(); ...
1
vote
1answer
82 views

C#- Renci.Ssh.Net- Which one gives optimized performance- WriteAllText Vs. UploadFile

I need to generate multiple XML files at SFTP location from C# code. for SFTP connectivity, I am using Renci.Ssh.net. I found there are different methods to generate files including WriteAllText() and ...
0
votes
0answers
108 views

Switch user to root by SSH.NET

I'm using SSH.NET in order to get some informations of an external tape drive. Connecting and executing some basic commands works perfectly fine for me: ConnectionInfo connNfo = new ConnectionInfo("...
-1
votes
1answer
19 views

How can SSH.NET on Windows 10 start a process on our remote Linux box that stays running?

This code blocks until the Linux process ends itself: cSSH.Connect() cSSH.RunCommand("<our path>linux_process”) <<< BLOCKS UNTIL linux_process ENDS ITSELF cSSH.Disconnect() cSSH....
1
vote
0answers
204 views

Randomly getting Renci.SshNet.SftpClient.Connect throwing SshConnectionException

I've seen other threads about this error, but I am having this error randomly. Out of 30 connects, 12 got this error. Trying to understand why would that be and what possible solutions are. using (...
1
vote
0answers
20 views

SSH.NET : cordova: command not found [duplicate]

I'm trying from a C# program to interact with a mac (Mac mini 2018 - Mojave) through SSH and the SSH.NET library to launch a cordova build. I can correctly configure SSH.NET to connect and send ...
-1
votes
1answer
80 views

Copying files within Remote unix server using Renci SSH.NET

I am trying to copy files from one folder to another within the remote unix server. I am using a web application in C# and using Renci SSH.Net for the process. When I using the Cp command , in the ...
1
vote
1answer
204 views

Copy file from Windows to remote Linux server using SSH.NET SshClient

I am using Visual Studio and C# web application . I am trying to move a file from Windows server to a remote Linux server using SSH.NET SshClient. I am trying the below code, but the file is not ...
1
vote
1answer
53 views

Providing subcommands to a command (sudo/su) executed with SSH.NET

I am trying to use Renci SSH.NET to connect to a remote Linux server from a C# web application and execute shell scripts. I want to run the scripts one after another. But not getting how to run the ...
1
vote
1answer
163 views

ExcelReaderFactory, reading from SftpFileStream

I am getting an error while reading a .xlsx file using ExcelReaderFactory.CreateOpenXmlReader(streamReader) and stream reader is a SftpFileStream (SftpClient.OpenRead(filePath)). The error message i ...
1
vote
1answer
404 views

C# SSH.NET - one SSH connection vs multiple SSH connections

I have a C# application which uses the SSH.NET library to connect to a server. The application executes SQL commands to the database through multiple methods. Is it better to have one long-running ...
1
vote
1answer
251 views

“SocketException: Could not resolve host” when connecting to SFTP server with SSH.NET

Trying to upload file to SFTP server in my local. Hit error when connect SFTP. System.Net.Sockets.SocketException: Could not resolve host 'sftp://localhost' I've tried using command-line and ...
1
vote
1answer
723 views

SSH.NET timeout when connecting to AWS Managed SFTP server in C#

I'm having issues trying to establish a connection to an AWS Managed SFTP server. Using the credentials I have on hand, I'm able to connect to the server from my Windows command line using the sftp ...
0
votes
1answer
215 views

How to move a file in sftp using renci library?

I am attempting to move file, yet nothing happens and no exceptions are reported. public static void MoveFiles(string source, string destination, LoginInfo loginInfo) { using (...
1
vote
1answer
229 views

Resolving DNS adress after proxy in SSH.NET

I'm using SSH.Net in C# and during connection behind a SOCKS5 proxy, I get the following exception: System.Net.Sockets.SocketException (0x80004005): No such host is known at System.Net.Dns....
0
votes
1answer
869 views

SSH.NET Public Key Authentication [duplicate]

I know that private key authentication works, however I'm looking for public key authentication. I'm trying to establish a connection using SSH.NET and a public key. In the Git Bash terminal I can ...
3
votes
1answer
178 views

Possible to have C# SSH client communicate with a NodeJS SSH Server?

I have a C# application that needs to run certain commands on a piece of hardware over SSH. The application is using SSH.Net to make the connection, send the command, and the read the result. I have ...
2
votes
1answer
366 views

Modified date time changes when moving a file from Windows to UNIX server using SSH.NET

I am using SSH.NET in my C# application to copy files from a Windows to a UNIX server, I have a few scenarios for this: In the UNIX server directory if the file to be copied does not exist, then the ...
0
votes
0answers
32 views

Facing problem for Ruckus controller command excute with C# Renci.SshNet SSH Client executecommand()

I am using Ruckus controller For wifi. So to fetch all ssids from ruckus i need to excute command in Ruckus CLI. Basically two command is there for all process. first to enter privileged EXEC mode by ...
1
vote
0answers
170 views

SSH.NET does not capture exception mesage

We are using Cerberus FTP server. And for the client I am using SSH.NET library to connect to server and upload a file. I was able to connect and upload files to FTP server without issue most of the ...
-1
votes
1answer
236 views

Read in output stream through ssh connection using Renci.SshNet

I've looked at a lot of other stack overflow posts but none of them really were similar to what I am trying to accomplish. Basically, I am trying to connect to a device running Windows CE through an ...
-1
votes
1answer
228 views

c# renci ssh command output differs from client to client

Something really odd is happening to me. I have ssh command which executes python script on my remote server. When I execute it through PuTTY it works like it should and desired output is shown. But ...
1
vote
1answer
410 views

C# send Ctrl+Y over SSH.NET

I am currently using SSH.net and trying to connect to an Avaya switch. My code looks like this: using (var client = new SshClient(ip, username, password)) { client.Connect(); //Sending CTRL+...
1
vote
1answer
219 views

SSH.NET - Changing Key Exchange Method

The webpage (https://github.com/sshnet/SSH.NET/) says it supports several Key Exchange Methods: SSH.NET supports the following key exchange methods: diffie-hellman-group-exchange-sha256 ...
0
votes
0answers
54 views

SSH.Net , recognize when shell ask for an input from user when launch command.BeginExecute()

i'm wondering if it's possible with SSH.net realize when the console or stream is asking for an user input. Example: SshClient client = new SshClient(host, plainUsername, plainPassword); SshCommand ...
2
votes
1answer
4k views

Downloading a directory using SSH.NET SFTP in C#

I am using Renci.SSH and C# to connect to my Unix server from a Windows machine. My code works as expected when the directory contents are only files, but if the directory contains a folder, I get ...
1
vote
1answer
209 views

Filtering . (this folder) and .. (parent folder) in SFTP directory listing in C# SSH.NET

I connect to SFTP host. That host has a folder files And one file in it. I need to get a list of names of file in that folder (files). I tried: using (var client = new SftpClient(FtpFolder, 22, ...
0
votes
0answers
90 views

SSH.net Cisco Router Inital connect failed

I am hobbyist programmer. I am getting error using Renci.SshNet. It gives me following error at statement sshclient.Connect(); System.Net.Sockets.SocketException:'The attempted operation is not ...
0
votes
1answer
178 views

Command not fully executing under ssh.net in c#

I'm taking the string generated by constructVirtBuilderCommand and using it as a command needed for my server to generate an image in xen. However, the command returns multiple things as it informs ...
0
votes
1answer
479 views

Display progress of asynchronous SSH.NET SFTP upload (BeginUploadFile) on progress bar

I'm using Renci SSH.NET as SFTP client in C#. Now I'm making a progress bar with this API. I tried with async and await, but I could not find the solution for getting downloaded bytes. I tried this ...
0
votes
0answers
46 views

SSH.NET library fails on Windows 2016 server, because of 16-bit dependency component

I am using SSH.NET library in my code to access sFTP site; everything works fine on Windows 10 machine (64 bit, of course), but the executable fails to start on Windows 2016 server with a message that ...
0
votes
0answers
69 views

Renci ssh.net vb.net killing PID on AIX server with powerbroker

I'm trying to develop a Windows Form in VB.NET which can connect to an AIX server and retrieve the PID#'s for certain processes. The PID#'s are then stored in a DataGrid. The Windows Form also needs ...
3
votes
1answer
112 views

2nd factor verification on every command through ssh.net

I am connecting to a Unix server using SSH.NET with the following code ssh = new SshClient("myserver.univ.edu", Username, Password); ssh.Connect(); The connection goes through and appears to ...
0
votes
1answer
229 views

Two factor authentication with ssh.net

I am trying to connect from a Windows app to a unix server, to run some commands (automating checks on server status). I am using the ssh.net library, and have this code to connect to the server: ...
0
votes
1answer
502 views

C# ssh.net library, cd command does not work ( cannot send “/” )

Every other command seems to work fine but it seems like I cannot send "/" using RunCommand() on ssh.net library. I need to change my working directory to run a program using "cd /home/debian". But ...
1
vote
1answer
620 views

How to list directories using SSH.NET?

I need to list directories on my Ubuntu machine. I did it with files, but I can't find similar solution for directories. public IEnumerable<string> GetFiles(string path) { using (var ...