How do I download a server file to Windows with SCP?
For a download, put the remote source first and the local Windows destination second. Your server account must be permitted to read the file. Select a local filename deliberately because SCP can replace an existing file.
Instructions
1. Inspect the remote source
Use your existing SSH session to confirm the path and whether the account can read it. Do not export secrets or customer data without authorisation.
ls -l "$HOME/report.txt"
sha256sum "$HOME/report.txt"The metadata and checksum identify the intended source file without changing it.
2. Download from a local terminal
Open a local Windows terminal, not the remote Linux shell.
scp adminuser@203.0.113.10:report.txt ".\server-report.txt"The remote source is relative to the account’s home. The destination is in the current Windows directory.
3. Verify the received file
Use SHA256 when you need to check that the same bytes arrived.
Get-Item -LiteralPath ".\server-report.txt" | Select-Object FullName, Length
Get-FileHash -LiteralPath ".\server-report.txt" -Algorithm SHA256Compare the hash to the trusted source value. A hash match does not determine whether the file is safe to execute.
Check the result
- The downloaded file is in the intended local directory.
- Its size and SHA256 hash match the source.
Troubleshooting
- Remote permission denied
- Request authorised read access or an approved export; do not broaden directory permissions.
- The file appears on the server instead
- You likely ran SCP from the remote shell. Return to the local Windows prompt and reassess both paths.
Official references
Use the documentation for your installed version when a flag, service name or platform feature differs.
