파일 복사 후 SCP 연결이 닫히지 않지만 PSCP의 경우 닫힙니다.

파일 복사 후 SCP 연결이 닫히지 않지만 PSCP의 경우 닫힙니다.

안녕하세요 저는인터니치일부 사용자 정의 하드웨어에서 실행되는 SSH 서버 스택. 다음과 같은 scp 명령을 사용하여 서버에서 클라이언트 PC로 일부 파일을 복사하려고 했지만 파일을 동시에 받은 후에도 연결이 계속 열려 있는 것을 발견했습니다 . scp 및 pscp 명령 모두에 gitbash 터미널을 사용했습니다.scp [email protected]:\\path\\to\\file /local/file/pathpscp -scp [email protected]:\\path\\to\\file /local/file/path

내가 이해할 수 없는 것은 실제로 두 명령 사이에 동작 차이가 있는 이유 pscp입니다 scp. PSCP 명령에 대한 디버그 로그는 다음과 같습니다.

$ 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 192.168.1.12
Server sent command exit status 0
Disconnected: All channels closed

그리고 여기는 SCP를 위한 것입니다

scp [email protected]:\\demo\\test_1.txt /d/test_1.txt
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.12 ([192.168.1.12]: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.

파일이 복사된 후에도 연결을 열린 상태로 유지하는 것은 무엇 SCP connection remains open until I hit ctrl+c manually. 입니까 ? SCP채널이 닫히지 않는 이유는 무엇입니까?

답변1

아마도 scp와 대화하려는 컴퓨터가 느린 것 같습니다. CTRL+C를 누르기 전에 얼마나 시간을 기다리셨나요? 때로는 scp가 연결을 닫는 데 속도가 느린 경우가 있습니다. 특히 앞에 특수 제한 쉘이 있는 경우에는 더욱 그렇습니다. 닫기를 기다리는 백그라운드에 scp를 넣을 수 있습니다(ctrl+z 및 bg). 또한 닫기를 기다리는 것을 피하기 위해 시간 초과 또는 이와 유사한 기능을 사용할 수 있습니다. (내 생각에는 scp와 pscp 간의 구성/구현이 다른 것 같습니다. 당신이 보여준 행동에서)

관련 정보