Posh-SSH
Posh-SSH copied to clipboard
Error with SCP for mikrotik
I can not use Set-SCPFile
for mikrotik. We can not use /
file path with mikrotik and scp.
This code work as expected:
scp csm.nov.ru.*.rsc [email protected]:
but there is my problem, i think: https://github.com/darkoperator/Posh-SSH/blob/927726685fe9228a79fcaacddaaf5b4576ed539e/Source/PoshSSH/PoshSSH/SetScpFile.cs#L434
My be:
var remoteFullpath = RemotePath + fil.Name;
???
To be honest no clue, I had to make that workaround to work around common mistakes and limitation of the library when used against Linux, in the ase of mikrotik since I have never used it I do not know if it s a platform specific thing.
On Oct 10, 2020, at 12:57 PM, Sergey S. Betke [email protected] wrote:
I can not use Set-SCPFile for mikrotik. We can not use / file path with mikrotik and scp.
This code work as expected:
but there is my problem, i think:
https://github.com/darkoperator/Posh-SSH/blob/927726685fe9228a79fcaacddaaf5b4576ed539e/Source/PoshSSH/PoshSSH/SetScpFile.cs#L434
My be: ```` var remoteFullpath = RemotePath + fil.Name; ??? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <https://github.com/darkoperator/Posh-SSH/issues/349>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAD7IHXDOHEAKF4F6BD4ZNTSKCHABANCNFSM4SLFWLAA>.
Yout code https://github.com/darkoperator/Posh-SSH/blob/927726685fe9228a79fcaacddaaf5b4576ed539e/Source/PoshSSH/PoshSSH/SetScpFile.cs#L434 add /
always. But for some platforms destinationPath
must be <userName>@<host>:
, without /
.
@sergey-s-betke, mikrotik can use / in remote path
your example works with mikrotik if subfolder already exists:
scp csm.nov.ru.*.rsc [email protected]:/subfilder
scp csm.nov.ru.*.rsc [email protected]:/subfilder/subfolder2
but Set-SCPFile
really hangup with any path. There may be other cause
Testing Renci.SshNet.dll directly... It hangs with any upload path so there may be bug inside it or even mikrotik
But SCP work as expected with mikrotik...
But this bug not in Posh-SSH
library.
You can bug report to https://github.com/sshnet/SSH.NET
short test in powershell
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')
As workaround you can use Set-SFTPFile
, it work well with mikrotik
btw, I just check it with latest beta and suggestions from https://github.com/sshnet/SSH.NET/wiki/ScpClient:-Remote-path-transformation
It still hangs with any type of RemotePathTransformation
Since it is a behaviors change it will not be changed any time soon, until I have time to code a major version number and do more testing.
On Oct 15, 2020, at 3:19 AM, Max Kozlov [email protected] wrote:
btw, I just check it with latest beta and suggestions from https://github.com/sshnet/SSH.NET/wiki/ScpClient:-Remote-path-transformation https://github.com/sshnet/SSH.NET/wiki/ScpClient:-Remote-path-transformation It still hangs with any type of RemotePathTransformation
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/349#issuecomment-708953485, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7IHQNK4XIZBWV3HDZA7LSK2PBLANCNFSM4SLFWLAA.