Posh-SSH SCP Hangs if SCP is not available on remote system

Open
#200 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start with the Set-SCPFile path and reproduce the upload against a remote *NIX host where scp is unavailable, using the command and timeout values shown. Done means the operation no longer hangs, reports the remote failure, and respects -OperationTimeout; verify that the same command completes when scp is restored.

Written by the indexing model from the issue text.

Description

Not all *NIX hosts come with SCP. We ran into this on a centos box, but there have been others. When SCP is not present on the remote system Posh-SSH SCP hangs. That said, SCP TO a remote device should not be dependant on and SCP client being available ON the remote device (as shown with the pscp example)

Putty fails to SCP, but Posh-SSH hangs if SCP is not available. Effect is shown in step 3 below.

  1. rename scp on remote system
[root@rhel-6-32 ~]# mv /usr/bin/scp /usr/bin/_scp
  1. show that putty can copy the file
C:\dev>\dev\pscp.exe -v -scp C:\dev\file.pub root@10.0.100.177:/tmp/test.pub
root@10.0.100.177's password:
Server sent command exit status 127
bash: scp: command not found
Fatal: Received unexpected end-of-file from server
  1. attempt to SCP the file with Posh-SSH
$SCP=Set-SCPFile -ComputerName $hostobject.computerName -Credential $credentialobject.credential -NoProgress -LocalFile $localFullPath -RemotePath "/tmp/"-Force:$Force  -ConnectionTimeout 6 -OperationTimeout 10 -Verbose -Debug
write-host "Complete"

VERBOSE: Using SSH Username and Password authentication for connection.
VERBOSE: Fingerprint for 10.0.100.177: a2:ce:97:5a:10:7:98:83:d9:9c:6f:2a:fa:9f:2c:42
VERBOSE: Fingerprint matched trusted fingerprint for host 10.0.100.177
VERBOSE: Connection successful
VERBOSE: Uploading C:\dev\file.pub

^^^^ Just hangs there, but also -OperationTimeout appears to be ignored

  1. put scp back on the remote system
[root@rhel-6-32 ~]# mv /usr/bin/_scp /usr/bin/scp
  1. attempt to SCP the file again
$SCP=Set-SCPFile -ComputerName $hostobject.computerName -Credential $credentialobject.credential -NoProgress -LocalFile $localFullPath -RemotePath "/tmp/"-Force:$Force  -ConnectionTimeout 6 -OperationTimeout 10 -Verbose -Debug
write-host "Complete"

VERBOSE: Using SSH Username and Password authentication for connection.
VERBOSE: Fingerprint for 10.0.100.177: a2:ce:97:5a:10:7:98:83:d9:9c:6f:2a:fa:9f:2c:42
VERBOSE: Fingerprint matched trusted fingerprint for host 10.0.100.177
VERBOSE: Connection successful
VERBOSE: Uploading C:\dev\file.pub
Complete

^^^ completed no problems

Dominant language
PowerShell
Stars
1.1k
Forks
222
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from darkoperator/Posh-SSH

All issues in darkoperator/Posh-SSH

Similar issues

More CLI issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.