Hi I have an InterNiche ssh server stack running on some custom hardware. I was trying to copy some files from server to client pc using scp command like scp [email protected]:\\path\\to\\file /local/file/path but found that connection remains open even after I have received the file at the same time when I use pscp -scp [email protected]:\\path\\to\\file /local/file/path it works fine without any failure. I used gitbash terminal for both scp and pscp commands.

What I am not able to understand is why there is behavioral difference between both commands, in fact pscp use scp itself. Here is the debug log for PSCP command

$ pscp -scp -v [email protected]:\\demo\\test_1.txt /d/test_1.txt    
[email protected]'s password:
Using username "user".
Sent password
Access granted
Opening session as main channel
Opened main channel
Started a shell/command
test_1.txt                | 0 kB |   0.0 kB/s | ETA: 00:00:00 | 100%
Using SCP1
Connected to
Server sent command exit status 0
Disconnected: All channels closed

and here is for SCP

scp [email protected]:\\demo\\test_1.txt /d/test_1.txt
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to ([]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending command: scp -v -f \\demo\\test_1.txt
Sink: C0777 16 \demo\test_1.txt
\demo\test_1.txt                                                             100%   16     0.0KB/s   05:49    debug1: channel 0: free: client-session, nchannels 1
Killed by signal 2.

The SCP connection remains open until I hit ctrl+c manually. What is it which keeps SCP connection in open state even after file gets copied. Why its not closing the channel?

1 Answer 1


Maybe the computer you try to talk with scp is slow... how much time did you wait before hitting CTRL+C ? Sometimes scp is slow to close the connection, especially with special restricted shells in front. You can try to put the scp in background waiting the close (ctrl+z and bg) Also, you can play with timeouts or something like this to avoid waiting for close (I think that is the different in configuration/implementation between scp and pscp from the behaviour you showed)

  • around 30 minutes. Feb 6, 2018 at 10:31
  • wow ! Your problem could be related to profile scripting... : linuxquestions.org/questions/red-hat-31/… Feb 6, 2018 at 10:37
  • But I am facing this issue only with one kind of sever, rest is working fine. Means scp command works fine with other devices like BBB, Rpi, but get stuck when I connect to this server. Feb 6, 2018 at 11:03
  • also ubuntu .bashrc contains this # If not running interactively, don't do anything case $- in *i*) ;; *) return;; esac which takes care of the problem. Feb 6, 2018 at 11:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .