sshnet / sshnet/SSH.NET

ScpClient.Upload and Mikrotik

Open
#745 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.4k
Forks
993
Avg merge
9d 21h
Merged PRs (30d)
1

Description

ScpClient.Upload do not work with mikrotik

I try to use latest beta with
Renci.SshNet.RemotePathTransformation.None according to #255
and found that Upload do not work with mikrotik.
There is also issue in Posh-SSH https://github.com/darkoperator/Posh-SSH/issues/349
My code is

Add-Type -Path D:\Renci.SshNet.dll
$client = [Renci.SshNet.ScpClient]::new($mikrotik_address, $mikrotik_port, $mikrotik_user, $mikrotik_password)
$client.connect()
$fi = [System.IO.FileInfo]::new('D:\Renci.SshNet.dll')
# There is a infinite hangup
$client.Upload($fi, 'file')

I tried to debug this problem and found that when I comment out UploadTimes(channel, input, file);
https://github.com/sshnet/SSH.NET/blob/develop/src/Renci.SshNet/ScpClient.NET.cs#L196
It works
Seems, mikrotik do not support UploadTimes at all. It creates file name with timestamp name
Is there any method to disable times support for some connections except commenting it out and have customized library?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/Renci.SshNet/ScpClient.NET.cs at ScpClient.Upload and the UploadTimes(channel, input, file) call, then reproduce the hang with the provided MikroTik and PowerShell example. Determine how timestamp handling behaves for this connection and verify that an upload completes without hanging while preserving existing behavior for supported servers.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.