povsister / scp

Production-ready Secure Copy Protocol (SCP) implementation in Golang
https://pkg.go.dev/github.com/povsister/scp
MIT License
45 stars 10 forks source link

CopyDirToRemote: "unexpected remote scp server failure: Process exited with status 1" when PreserveProp: true #4

Closed decentral1se closed 4 months ago

decentral1se commented 2 years ago

When using scpClient.CopyDirToRemote I keep running into scp: unexpected remote scp server failure: Process exited with status 1 which isn't telling me much :upside_down_face: I can confirm that my SSH configuration works to make the connection and I'm passing in something like so:

scpClient.CopyDirToRemote("/home/d/mydir", "public_html", opts)

I've tried a combination of paths in both positions but no luck. I've also confirmed regular scp is working.

(Rad project btw, thanks for all the work!)

decentral1se commented 2 years ago

Ah, once I remove PreserveProp: true from my opts, it worked :partying_face:

povsister commented 4 months ago

Ah, once I remove PreserveProp: true from my opts, it worked 🥳

As far as I know, some scp implementation doesn't support all features we normally think they would have.

PreserveProp: true means file mtime/ctime and its mode bits are preserved during copy, probably the remote SCP server doesn't recognize commands sent in pre-flight as file metadata.

You can run man scp on the remote server to check its doc, if you cann't find a parameter like -p Preserves modification times, access times, and file mode bits from the source file., that means your scp server probably doesn't support preserve file properties during copy.

I am closing this issue since no plan to fix it. Feel free to re-open it if you want to dive deeper into it.