SCP - Secure Copy Protocol
What is SCP?
SCP (Secure Copy Protocol) is a network protocol used to securely transfer files between a local host and a remote host or between two remote hosts. It is based on the SSH (Secure Shell) protocol, ensuring encrypted file transfers over insecure networks.
Why is SCP useful?
Secure file transfer – Uses SSH for encryption, ensuring confidentiality and integrity.
Simple and fast – Command-line based and efficient for quick file transfers.
Authentication support – Leverages SSH keys or passwords for secure access.
Cross-platform – Available on Unix/Linux, macOS, and Windows (via tools like PuTTY or OpenSSH).
No setup required on the server – If SSH is enabled, SCP works out of the box.
How does it work?
User runs the scp command specifying the source and destination paths.
SCP uses SSH to authenticate the user on the remote system.
An encrypted SSH tunnel is established for the file transfer.
Data is securely copied from the source to the destination.
Once complete, the SSH session is terminated.
Where is SCP used?
System administration – Moving configuration files or logs between servers.
DevOps workflows – Automating deployments or backups in scripts.
Remote development – Transferring code or assets to remote environments.
Secure backups – Copying files to remote backup servers.
IoT and embedded systems – Transferring firmware or logs securely.
Which OSI Layer does this protocol belong to?
SCP operates at the Session Layer (Layer 5) of the OSI model.
It establishes and manages a secure session via SSH.
Operates above the transport layer (TCP), focusing on secure session-level communication and file transfer.
Topics in this section,
In this section, you are going to learn
Terminology
Version Info
SCP |
RFC |
Year |
Core Idea / Contribution |
---|---|---|---|
Version |
|||
Legacy SCP (based on RCP) |
|||
No official RFC |
~1980s1990s |
Original SCP built on BSD RCP, using SSH for secure transport. Simple, but lacks extensibility and error handling. |
|
OpenSSH SCP (pre-9.0) |
|||
No RFC |
19992019 |
Widely used implementation. Relies on SSH and uses scp -t/-f for file transfer. Known for security limitations and inflexibility. |
|
OpenSSH SCP (post-9.0) |
|||
No RFC |
2022 |
Switched to using SFTP under the hood for better security and compatibility, while keeping the scp command-line interface. |
|
SCP Draft Specification |
|||
draft-mazieres-dinrg-scp-00 to 06 |
20202022 |
Stanford-led effort to formally define SCP as an IETF draft. Introduces structured protocol messages, better error handling, and extensibility. Not yet standardized. |
setup
setup
SSH Transport Layer Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
1 |
SSH Transport Layer Packet |
Establishes a secure channel between client |
Variable |
and server |
|||
Protocol Version |
SSH version string (e.g., SSH-2.0-OpenSSH_8.0) |
Variable |
|
Key Exchange Init |
Negotiates algorithms (encryption, MAC, compression) |
Variable |
|
Server Public Key |
Server sends its public key |
Variable |
|
New Keys |
Both sides confirm encryption keys |
Variable |
|
SSH User Authentication Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
2 |
SSH User Authentication Packet |
Authenticates the client to the server |
Variable |
Service Request |
Request for “ssh-userauth” service |
Variable |
|
User Auth Request |
Username, method (e.g., password/public key) |
Variable |
|
Auth Success |
Server confirms authentication |
Variable |
|
SSH Channel Open Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
3 |
SSH Channel Open Packet |
Opens a session channel for SCP |
Variable |
Channel Type |
session |
Variable |
|
Sender Channel |
Client’s channel ID |
4 |
|
Initial Window Size |
Flow control window |
4 |
|
Maximum Packet Size |
Max size of SSH packet |
4 |
|
SCP Command Execution Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
4 |
SCP Command Execution Packet |
Executes the SCP command on the server |
Variable |
Exec Request |
SSH channel request to run scp -t or scp -f |
Variable |
|
Command String |
SCP command with flags |
Variable |
|
SCP Timestamp Packet (T) Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
5 |
SCP Timestamp Packet (T) |
Optional timestamp for file (modification |
Variable |
/access time) |
|||
T Message |
Starts with T |
1 |
|
Modification Time |
UNIX timestamp |
Variable |
|
Access Time |
UNIX timestamp |
Variable |
|
End Marker |
Newline (n) |
1 |
|
SCP File Info Packet (C) Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
6 |
SCP File Info Packet (C) |
Metadata for file transfer |
Variable |
C Message |
Starts with C |
1 |
|
File Mode |
e.g., 0644 |
4 |
|
File Size |
In bytes |
Variable |
|
File Name |
UTF-8 string |
Variable |
|
End Marker |
Newline (n) |
1 |
|
SCP Directory Info Packet (D) Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
7 |
SCP Directory Info Packet (D) |
Indicates start of directory transfer |
Variable |
D Message |
Starts with D |
1 |
|
Directory Mode |
e.g., 0755 |
4 |
|
Dummy Size |
Always 0 |
1 |
|
Directory Name |
UTF-8 string |
Variable |
|
End Marker |
Newline (n) |
1 |
|
SCP End Directory Packet (E) Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
8 |
SCP End Directory Packet (E) |
Indicates end of directory transfer |
2 |
E Message |
Starts with E |
1 |
|
End Marker |
Newline (n) |
1 |
|
SCP File Data Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
9 |
SCP File Data Packet |
Carries actual file content |
File size + 1 |
File Content |
Raw binary data |
File size |
|
Acknowledgment |
Null byte (0) |
1 |
|
SCP Acknowledgment Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
10 |
SCP Acknowledgment Packet |
Confirms successful receipt or error |
1+ |
ACK Byte |
0 = OK, 1 = Warning, 2 = Fatal Error |
1 |
|
Error Message |
Optional (for 1 or 2) |
Variable |
|
SSH Channel Close Packet
S.No |
Protocol Packets |
Description |
Size(bytes) |
---|---|---|---|
11 |
SSH Channel Close Packet |
Gracefully closes the SCP session |
Variable |
Channel Close |
SSH message to close channel |
Variable |
|
Channel EOF |
Indicates end of data stream |
Variable |
|
s.no |
Use Case |
Description |
---|---|---|
1 |
Remote File Transfer |
Securely copy files from a local machine to a remote server or vice versa using SSH encryption. |
2 |
Automated Backups |
Used in scripts and cron jobs to automate secure backups of files and directories across systems. |
3 |
Deployment Pipelines |
Transfers build artifacts or configuration files to remote servers during CI/CD deployments. |
4 |
Cross-Platform File Sync |
Enables file synchronization between different operating systems over SSH. |
5 |
Disaster Recovery |
Helps in restoring files from remote backup servers in case of data loss. |
6 |
Secure File Sharing |
Allows users to share files securely over untrusted networks without setting up additional services. |
7 |
IoT Device Updates |
Used to push firmware or configuration updates to remote IoT devices over SSH. |
8 |
Temporary File Hosting |
Developers or admins can quickly upload files to a server for temporary access or testing. |
S.no |
Feature |
Description |
---|---|---|
1 |
SSH-Based Security |
SCP uses SSH for authentication and encryption, ensuring secure file transfers. |
2 |
Simple Command-Line Interface |
Offers a straightforward syntax for copying files between systems. |
3 |
Bidirectional Transfer |
Supports both uploading to and downloading from remote servers. |
4 |
Recursive Copy |
Allows copying entire directories using the -r option. |
5 |
Preserves File Attributes |
Maintains original file timestamps and permissions with the -p flag. |
6 |
Cross-Platform Compatibility |
Works across Unix, Linux, macOS, and Windows (via tools like PuTTY or OpenSSH). |
7 |
No Need for Additional Setup |
Requires only SSH accessno separate server or configuration needed. |
8 |
Script-Friendly |
Easily integrated into shell scripts for automation and batch operations. |
SSH Based Security - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
SSH Port Default |
Use SCP without specifying port |
Connects via port 22 |
2 |
SSH Port Custom |
Use SCP with -P option |
Connects via specified port |
3 |
SSH Service Down |
Stop SSH on server |
SCP fails to connect |
4 |
Password Authentication Success |
Use correct username and password |
File transfer succeeds |
5 |
Password Authentication Failure |
Use incorrect password |
Authentication fails |
6 |
Key Authentication Success |
Use valid private key |
File transfer succeeds |
7 |
Key Authentication Failure |
Use invalid private key |
Authentication fails |
8 |
Unauthorized Key |
Use key not in authorized_keys |
Authentication fails |
9 |
RSA Key Support |
Use RSA key for authentication |
SCP succeeds |
10 |
ECDSA Key Support |
Use ECDSA key for authentication |
SCP succeeds |
11 |
Ed25519 Key Support |
Use Ed25519 key for authentication |
SCP succeeds |
12 |
Encrypted File Transfer |
Monitor traffic during SCP |
Data is encrypted |
13 |
Encrypted Credentials |
Monitor login credentials |
Credentials are encrypted |
14 |
SSH Host Key Verification |
Connect to new host |
Prompts for host key confirmation |
15 |
Host Key Mismatch |
Modify known_hosts entry |
SCP fails with warning |
16 |
SSH Agent Usage |
Use ssh-agent with loaded key |
SCP succeeds without password |
17 |
SSH Key Permissions |
Set key file to 777 |
SCP fails with permission error |
18 |
SSH Protocol Version 2 |
Force protocol version 2 |
SCP succeeds |
19 |
SSH Protocol Version 1 |
Force protocol version 1 |
SCP fails |
20 |
SSH Compression |
Use -C option |
Transfer succeeds with compression |
21 |
SSH Config File |
Use host alias from ~/.ssh/config |
SCP resolves alias and connects |
22 |
SSH Timeout |
Set short timeout |
SCP fails if server is slow |
23 |
SSH KeepAlive |
Enable keep-alive |
Long transfers stay connected |
24 |
SSH Multiplexing |
Use ControlMaster session |
SCP reuses existing connection |
25 |
SSH Strict Host Checking |
Enable strict checking |
SCP fails on unknown host |
26 |
SSH Login Banner |
Enable banner on server |
Banner is displayed before authentication |
27 |
SSH Rekeying |
Monitor long session |
Rekeying occurs automatically |
28 |
SSH MAC Algorithm |
Use hmac-sha2-256 |
SCP succeeds |
29 |
SSH Cipher Algorithm |
Use aes256-ctr |
SCP succeeds |
30 |
SSH Kex Algorithm |
Use diffie-hellman-group14-sha1 |
SCP succeeds |
31 |
Disabled Cipher |
Disable cipher on server |
SCP fails if cipher is required |
32 |
Disabled MAC |
Disable MAC on server |
SCP fails if MAC is required |
33 |
Disabled Kex |
Disable Kex on server |
SCP fails if Kex is required |
34 |
SSH Audit Logging |
Enable audit logs |
SCP session is logged |
35 |
SSH AllowUsers Restriction |
Restrict user in sshd_config |
SCP fails for disallowed user |
36 |
SSH Chroot Jail |
Use chrooted user |
SCP limited to chroot directory |
37 |
SSH Login Grace Time |
Set short grace time |
SCP fails if login delayed |
38 |
SSH Key Expiry |
Use expired key |
SCP fails |
39 |
SSH Key Revocation |
Revoke key using revoked_keys |
SCP fails |
40 |
SSH Session Hijack Attempt |
Attempt MITM attack |
SCP fails with host key mismatch |
41 |
SCP with ProxyJump |
Use -J option |
SCP connects via jump host |
42 |
SCP with Bastion Host |
Use SCP through bastion |
File transfer succeeds |
43 |
SCP with VPN Tunnel |
Use SCP over VPN |
File transfer succeeds securely |
44 |
SCP with IPv6 |
Use IPv6 address |
SCP succeeds |
45 |
SCP with DNS Spoofing |
Spoof DNS to wrong IP |
SCP fails with host key mismatch |
46 |
SCP with SSH Port Knocking |
Use port knocking before SCP |
SCP succeeds after knock |
47 |
SCP with Fail2Ban |
Trigger multiple failures |
IP gets banned |
48 |
SCP with SELinux |
Enable SELinux enforcement |
SCP respects SELinux policies |
49 |
SCP with AppArmor |
Enable AppArmor profile |
SCP operates within profile limits |
50 |
SCP with Logging Enabled |
Enable verbose logging (-v) |
Logs show SSH negotiation and file transfer |
Simple Command Line Interface - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
Basic File Copy |
Copy a file from local to remote |
File appears on remote system |
2 |
Basic File Download |
Copy a file from remote to local |
File appears on local system |
3 |
Directory Copy |
Use -r to copy a directory |
Entire directory copied |
4 |
Use of Colon Syntax |
Use user@host:path format |
SCP parses correctly |
5 |
Use of Absolute Path |
Use full path in source or destination |
SCP resolves path correctly |
6 |
Use of Relative Path |
Use relative path in source or destination |
SCP resolves path correctly |
7 |
Use of ~ for Home Directory |
Use ~ in path |
SCP expands to home directory |
8 |
Use of Wildcards |
Use *.txt to copy multiple files |
All matching files copied |
9 |
Use of Port Option |
Use -P to specify custom port |
SCP connects to specified port |
10 |
Use of Verbose Mode |
Use -v option |
SCP prints detailed logs |
11 |
Use of Quiet Mode |
Use -q option |
SCP suppresses output |
12 |
Use of Compression |
Use -C option |
SCP compresses data during transfer |
13 |
Use of Identity File |
Use -i with SSH key |
SCP uses specified key |
14 |
Use of IPv6 Address |
Use [IPv6]:path format |
SCP connects via IPv6 |
15 |
Use of SCP with Host Alias |
Use alias from ~/.ssh/config |
SCP resolves alias |
16 |
Use of SCP with Spaces in Filename |
Use quotes or escape characters |
File copied correctly |
17 |
Use of SCP with Special Characters |
Use file with @, #, $ in name |
File copied correctly |
18 |
Use of SCP with Symlink |
Copy symlink |
Symlink copied as file or link (based on flags) |
19 |
Use of SCP with Large File |
Copy file >1GB |
File copied successfully |
20 |
Use of SCP with Binary File |
Copy executable or binary |
File integrity preserved |
21 |
Use of SCP with Text File |
Copy .txt file |
File content preserved |
22 |
Use of SCP with Hidden File |
Copy .hidden file |
File copied successfully |
23 |
Use of SCP with File Permissions |
Check if permissions are preserved |
File permissions retained |
24 |
Use of SCP with Directory Permissions |
Copy directory with permissions |
Permissions retained |
25 |
Use of SCP with SSH Agent |
Use agent-loaded key |
SCP succeeds without password |
26 |
Use of SCP with SSH Config |
Use custom config file |
SCP uses config settings |
27 |
Use of SCP with Timeout |
Set timeout using ConnectTimeout |
SCP fails if timeout exceeded |
28 |
Use of SCP with ProxyJump |
Use -J option |
SCP connects via jump host |
29 |
Use of SCP with Bastion Host |
Use SCP through bastion |
File copied successfully |
30 |
Use of SCP with VPN |
Use SCP over VPN |
File copied securely |
31 |
Use of SCP with IPv4 |
Use IPv4 address |
SCP connects successfully |
32 |
Use of SCP with DNS Name |
Use hostname instead of IP |
SCP resolves and connects |
33 |
Use of SCP with Invalid Hostname |
Use non-existent hostname |
SCP fails with error |
34 |
Use of SCP with Invalid Path |
Use invalid file path |
SCP fails with error |
35 |
Use of SCP with No Permissions |
Try copying to restricted directory |
SCP fails with permission denied |
36 |
Use of SCP with Read-Only File |
Copy read-only file |
File copied successfully |
37 |
Use of SCP with Write-Only Directory |
Try copying to write-only directory |
SCP succeeds |
38 |
Use of SCP with File Overwrite |
Copy file with same name |
File is overwritten |
39 |
Use of SCP with File Append |
Try to append to existing file |
Not supported (fails or overwrites) |
40 |
Use of SCP with File Rename |
Copy file with new name |
File saved with new name |
41 |
Use of SCP with Multiple Files |
Copy multiple files in one command |
All files copied |
42 |
Use of SCP with Directory Tree |
Copy nested directories |
Structure preserved |
43 |
Use of SCP with File Timestamps |
Check if timestamps are preserved |
Timestamps retained |
44 |
Use of SCP with File Ownership |
Check if ownership is preserved |
Ownership may not be retained |
45 |
Use of SCP with Symbolic Link Target |
Copy target of symlink |
Target file copied |
46 |
Use of SCP with Broken Symlink |
Copy broken symlink |
Error or symlink copied as-is |
47 |
Use of SCP with File Integrity Check |
Compare checksums before and after |
Checksums match |
48 |
Use of SCP with Logging Enabled |
Enable verbose logging |
Logs show command execution |
49 |
Use of SCP with Dry Run (Simulated) |
Simulate SCP command (e.g., with echo) |
Command syntax validated |
50 |
Use of SCP with Exit Code Check |
Check SCP exit status |
0 = success, non-zero = failure |
Bidirectional Transfer - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
Upload Single File |
Copy one file from local to remote |
File appears on remote |
2 |
Download Single File |
Copy one file from remote to local |
File appears on local |
3 |
Upload Directory |
Use -r to upload a directory |
Directory and contents copied to remote |
4 |
Download Directory |
Use -r to download a directory |
Directory and contents copied to local |
5 |
Upload with Wildcard |
Use *.txt to upload multiple files |
All matching files uploaded |
6 |
Download with Wildcard |
Use *.log to download multiple files |
All matching files downloaded |
7 |
Upload to Home Directory |
Upload file to ~ on remote |
File appears in remote home directory |
8 |
Download from Home Directory |
Download file from ~ on remote |
File appears in local directory |
9 |
Upload with Rename |
Upload file with new name |
File saved with new name on remote |
10 |
Download with Rename |
Download file with new name |
File saved with new name on local |
11 |
Upload with Absolute Path |
Use full path for destination |
File copied to exact location |
12 |
Download with Absolute Path |
Use full path for source |
File copied from exact location |
13 |
Upload with Relative Path |
Use relative path for destination |
File copied relative to remote home |
14 |
Download with Relative Path |
Use relative path for source |
File copied relative to remote home |
15 |
Upload Hidden File |
Upload .hidden file |
File appears on remote |
16 |
Download Hidden File |
Download .hidden file |
File appears on local |
17 |
Upload Binary File |
Upload executable or binary |
File integrity preserved |
18 |
Download Binary File |
Download executable or binary |
File integrity preserved |
19 |
Upload Large File |
Upload file >1GB |
File copied successfully |
20 |
Download Large File |
Download file >1GB |
File copied successfully |
21 |
Upload with SSH Key |
Use -i option |
File copied securely |
22 |
Download with SSH Key |
Use -i option |
File copied securely |
23 |
Upload with Password |
Use password authentication |
File copied after login |
24 |
Download with Password |
Use password authentication |
File copied after login |
25 |
Upload with Port Option |
Use -P to specify port |
File copied via custom port |
26 |
Download with Port Option |
Use -P to specify port |
File copied via custom port |
27 |
Upload with Verbose Mode |
Use -v option |
Logs show upload process |
28 |
Download with Verbose Mode |
Use -v option |
Logs show download process |
29 |
Upload with Compression |
Use -C option |
File compressed during transfer |
30 |
Download with Compression |
Use -C option |
File compressed during transfer |
31 |
Upload with Symlink |
Upload symlink |
Symlink copied or dereferenced |
32 |
Download with Symlink |
Download symlink |
Symlink copied or dereferenced |
33 |
Upload with Special Characters |
Upload file with @, #, $ in name |
File copied correctly |
34 |
Download with Special Characters |
Download file with @, #, $ in name |
File copied correctly |
35 |
Upload with File Permissions |
Upload file and check permissions |
Permissions retained or modified |
36 |
Download with File Permissions |
Download file and check permissions |
Permissions retained or modified |
37 |
Upload with Timestamp Check |
Check timestamp after upload |
Timestamp preserved or updated |
38 |
Download with Timestamp Check |
Check timestamp after download |
Timestamp preserved or updated |
39 |
Upload to Nonexistent Directory |
Upload to a non-existent path |
SCP fails with error |
40 |
Download from Nonexistent File |
Download a missing file |
SCP fails with error |
41 |
Upload with SSH Config Alias |
Use alias from SSH config |
File copied using alias |
42 |
Download with SSH Config Alias |
Use alias from SSH config |
File copied using alias |
43 |
Upload with IPv6 Address |
Use [IPv6] format |
File copied successfully |
44 |
Download with IPv6 Address |
Use [IPv6] format |
File copied successfully |
45 |
Upload with SCP in Script |
Automate SCP in shell script |
File copied without manual input |
46 |
Download with SCP in Script |
Automate SCP in shell script |
File copied without manual input |
47 |
Upload with Exit Code Check |
Check exit code after upload |
0 = success, non-zero = failure |
48 |
Download with Exit Code Check |
Check exit code after download |
0 = success, non-zero = failure |
49 |
Upload with Logging Enabled |
Enable logging |
Upload activity logged |
50 |
Download with Logging Enabled |
Enable logging |
Download activity logged |
Recursive Copy - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
Copy Single-Level Directory |
Copy a directory with one level of files |
All files copied |
2 |
Copy Multi-Level Directory |
Copy nested directories |
Full structure preserved |
3 |
Copy Empty Directory |
Copy a directory with no files |
Empty directory created on destination |
4 |
Copy Directory with Hidden Files |
Include .hidden files |
Hidden files copied |
5 |
Copy Directory with Symlinks |
Include symbolic links |
Symlinks copied or dereferenced |
6 |
Copy Directory with Large Files |
Include files >1GB |
Files copied successfully |
7 |
Copy Directory with Special Characters |
Directory name has @, #, $, etc. |
Directory copied correctly |
8 |
Copy Directory with Spaces |
Directory name has spaces |
Quoted or escaped path works |
9 |
Copy Directory with Permissions |
Check if file permissions are preserved |
Permissions retained |
10 |
Copy Directory with Timestamps |
Check if timestamps are preserved |
Timestamps retained |
11 |
Copy Directory to Remote |
Upload directory to remote server |
Directory appears on remote |
12 |
Copy Directory from Remote |
Download directory from remote server |
Directory appears on local |
13 |
Copy Directory with -v |
Use verbose mode |
Logs show recursive copy |
14 |
Copy Directory with -C |
Use compression |
Transfer is compressed |
15 |
Copy Directory with -i |
Use identity file |
Authenticated and copied |
16 |
Copy Directory with -P |
Use custom port |
SCP connects and copies |
17 |
Copy Directory with Wildcards |
Use dir*/ |
All matching directories copied |
18 |
Copy Directory with Read-Only Files |
Include read-only files |
Files copied successfully |
19 |
Copy Directory with Write-Only Files |
Include write-only files |
Files copied successfully |
20 |
Copy Directory with Executables |
Include .exe, .sh, etc. |
Files copied with permissions |
21 |
Copy Directory with Binary Files |
Include non-text files |
Files copied without corruption |
22 |
Copy Directory with Text Files |
Include .txt, .log, etc. |
Files copied correctly |
23 |
Copy Directory with Nested Symlinks |
Symlinks point to other symlinks |
Structure preserved or dereferenced |
24 |
Copy Directory with Broken Symlinks |
Include broken links |
Links copied as-is |
25 |
Copy Directory with SSH Config Alias |
Use alias from SSH config |
SCP resolves and copies |
26 |
Copy Directory with IPv6 |
Use IPv6 address |
SCP connects and copies |
27 |
Copy Directory with IPv4 |
Use IPv4 address |
SCP connects and copies |
28 |
Copy Directory with DNS Name |
Use hostname |
SCP resolves and copies |
29 |
Copy Directory with Invalid Path |
Use non-existent path |
SCP fails with error |
30 |
Copy Directory with No Permissions |
Try copying to restricted directory |
SCP fails with permission denied |
31 |
Copy Directory with SSH Agent |
Use agent-loaded key |
SCP succeeds |
32 |
Copy Directory with SSH Timeout |
Set short timeout |
SCP fails if slow |
33 |
Copy Directory with ProxyJump |
Use -J option |
SCP connects via jump host |
34 |
Copy Directory with VPN |
Use SCP over VPN |
Directory copied securely |
35 |
Copy Directory with Bastion Host |
Use SCP through bastion |
Directory copied |
36 |
Copy Directory with Logging Enabled |
Enable verbose logging |
Logs show recursive copy |
37 |
Copy Directory with Exit Code Check |
Check exit code after copy |
0 = success, non-zero = failure |
38 |
Copy Directory with File Rename |
Rename directory during copy |
New name appears at destination |
39 |
Copy Directory with File Overwrite |
Copy over existing directory |
Files overwritten |
40 |
Copy Directory with File Append |
Try to append to existing files |
Not supported (overwrites) |
41 |
Copy Directory with File Ownership |
Check if ownership is preserved |
May not retain ownership |
42 |
Copy Directory with SSH Banner |
Server shows banner |
Banner displayed before copy |
43 |
Copy Directory with SSH Rekeying |
Long session triggers rekey |
Rekeying occurs |
44 |
Copy Directory with SCP in Script |
Automate SCP in shell script |
Directory copied without manual input |
45 |
Copy Directory with Dry Run Simulation |
Simulate SCP command |
Syntax validated |
46 |
Copy Directory with File Integrity |
Compare checksums before and after |
Checksums match |
47 |
Copy Directory with File Count Check |
Count files before and after |
Counts match |
48 |
Copy Directory with Network Interruption |
Disconnect during transfer |
SCP fails or resumes |
49 |
Copy Directory with SSH Multiplexing |
Use ControlMaster session |
SCP reuses connection |
50 |
Copy Directory with SCP on Windows |
Use SCP from Windows client |
Directory copied to/from remote |
Preserves File Attributes - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
Preserve Timestamps |
Transfer file with -p |
Access and modification times are preserved |
2 |
Preserve Permissions |
Transfer file with -p |
File permissions (e.g., 755) are preserved |
3 |
Preserve Owner UID/GID |
Transfer as root with -p |
UID and GID preserved (if supported) |
4 |
Without -p Flag |
Transfer file without -p |
Timestamps and permissions are not preserved |
5 |
Directory Transfer with -p |
Use -rp to copy directory |
All files and subdirectories preserve attributes |
6 |
Symbolic Link Attributes |
Transfer symlink with -p |
Symlink metadata preserved (not dereferenced) |
7 |
Special Characters in Filename |
Transfer file with spaces/symbols using -p |
Attributes preserved correctly |
8 |
Hidden Files |
Transfer .hidden file with -p |
Attributes preserved |
9 |
File with Extended Attributes |
Transfer file with ACLs or xattrs |
Extended attributes preserved (if supported) |
10 |
File with Sticky Bit |
Transfer file with sticky bit set |
Sticky bit preserved |
11 |
File with SetUID/SetGID |
Transfer file with special permission bits |
SetUID/SetGID preserved |
12 |
File with No Read Permission |
Transfer file with -p |
Attributes preserved even if file unreadable |
13 |
File with Future Timestamp |
Transfer file with future timestamp |
Future timestamp preserved |
14 |
File with Epoch Timestamp |
Transfer file with timestamp = 0 |
Timestamp preserved |
15 |
File with Millisecond Precision |
Transfer file with high-resolution timestamp |
Precision preserved (if supported) |
16 |
File with Different Timezone |
Transfer between systems in different timezones |
UTC-based timestamps preserved |
17 |
File with Different Locale |
Transfer between systems with different locales |
Attributes preserved regardless of locale |
18 |
File with UTF-8 Name |
Transfer file with Unicode characters |
Attributes preserved |
19 |
File with Non-ASCII Permissions |
Transfer file with non-standard permission bits |
Permissions preserved |
20 |
File with SELinux Context |
Transfer file with SELinux enabled |
Context may not be preserved (documented behavior) |
21 |
File with AppArmor Profile |
Transfer file under AppArmor |
Attributes preserved; profile not transferred |
22 |
File with Immutable Bit |
Transfer file with chattr +i |
Immutable bit not preserved (expected) |
23 |
File with ACLs |
Transfer file with Access Control Lists |
ACLs preserved (if supported) |
24 |
File with Sparse Blocks |
Transfer sparse file with -p |
Attributes preserved; sparseness may not be |
25 |
File with Hard Links |
Transfer hard-linked files |
Attributes preserved; hard link not preserved |
26 |
File with Large UID/GID |
Transfer file with UID/GID > 65535 |
Attributes preserved |
27 |
File with Root Ownership |
Transfer as root with -p |
Ownership preserved |
28 |
File with Group Ownership |
Transfer file with specific group |
Group ownership preserved |
29 |
File with No Group |
Transfer file with no group |
Group preserved as-is |
30 |
File with Read-Only Attribute |
Transfer file marked read-only |
Read-only flag preserved |
31 |
File with Executable Bit |
Transfer script with -p |
Executable bit preserved |
32 |
File with Mixed Permissions |
Transfer file with 764 permissions |
Permissions preserved |
33 |
File with Inherited Permissions |
Transfer file from inherited ACL directory |
Attributes preserved |
34 |
File with Broken Symlink |
Transfer broken symlink with -p |
Symlink preserved as-is |
35 |
File with Special Device Type |
Transfer device file (e.g., /dev/null) |
Attributes preserved (if supported) |
36 |
File with Extended Timestamp Format |
Transfer file with nanosecond timestamps |
Precision preserved (if supported) |
37 |
File with DOS Attributes |
Transfer file from Windows with -p |
Attributes preserved where applicable |
38 |
File with Mac Metadata |
Transfer file from macOS with -p |
Metadata may not be preserved (expected) |
39 |
File with Network Share Attributes |
Transfer file from NFS/SMB mount |
Attributes preserved if supported |
40 |
File with Encrypted FS |
Transfer file from eCryptfs or LUKS |
Attributes preserved; content encrypted |
41 |
File with Compression |
Transfer compressed file with -p |
Attributes preserved |
42 |
File with Checksum Validation |
Compare checksums after transfer |
Attributes and content match |
43 |
File with Backup Timestamp |
Transfer backup file with -p |
Backup timestamp preserved |
44 |
File with Temporary Attributes |
Transfer temp file with -p |
Attributes preserved |
45 |
File with Symbolic Permissions |
Transfer file with symbolic mode (e.g., u+x) |
Permissions preserved |
46 |
File with Multiple Owners (NFS) |
Transfer file from NFS with multiple owners |
Attributes preserved if supported |
47 |
File with Time Drift |
Transfer between systems with clock drift |
Timestamps preserved as-is |
48 |
File with Time Sync Enabled |
Transfer between NTP-synced systems |
Timestamps preserved accurately |
49 |
File with Time Sync Disabled |
Transfer between unsynced systems |
Timestamps preserved but may appear inconsistent |
50 |
File with Metadata Logging |
Log file metadata before and after transfer |
Logs confirm attributes preserved |
Cross Platform Compatibility - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
Linux to Linux Transfer |
Transfer file between two Linux systems |
File transfers successfully |
2 |
Linux to macOS Transfer |
Transfer file from Linux to macOS |
File transfers successfully |
3 |
macOS to Linux Transfer |
Transfer file from macOS to Linux |
File transfers successfully |
4 |
Linux to Windows (OpenSSH) |
Transfer file to Windows with OpenSSH server |
File transfers successfully |
5 |
Windows to Linux (WinSCP) |
Use WinSCP to transfer file to Linux |
File transfers successfully |
6 |
Windows to macOS (WinSCP) |
Use WinSCP to transfer file to macOS |
File transfers successfully |
7 |
Windows to Linux (PuTTY/pscp) |
Use pscp.exe from PuTTY suite |
File transfers successfully |
8 |
Windows to Linux (PowerShell SCP) |
Use PowerShell SCP command |
File transfers successfully |
9 |
Windows to Linux (WSL SCP) |
Use SCP from Windows Subsystem for Linux |
File transfers successfully |
10 |
Linux to Windows (SCP with OpenSSH) |
Transfer file to Windows with OpenSSH |
File transfers successfully |
11 |
SCP on Cygwin |
Use SCP via Cygwin on Windows |
File transfers successfully |
12 |
SCP on Git Bash |
Use SCP via Git Bash on Windows |
File transfers successfully |
13 |
SCP on Termux (Android) |
Use SCP on Android via Termux |
File transfers successfully |
14 |
SCP on iOS (via app) |
Use SCP-capable app on iOS |
File transfers successfully |
15 |
SCP on Android (via app) |
Use SCP-capable app on Android |
File transfers successfully |
16 |
SCP with UTF-8 Filenames |
Transfer files with Unicode names across platforms |
Filenames preserved correctly |
17 |
SCP with Different Line Endings |
Transfer text files between Windows and Unix |
Line endings preserved or converted as expected |
18 |
SCP with Executable Files |
Transfer .exe or .sh files |
Files remain executable on target OS |
19 |
SCP with File Permissions (Unix to Windows) |
Transfer file with -p from Unix to Windows |
Permissions may not be preserved (expected) |
20 |
SCP with File Permissions (Windows to Unix) |
Transfer file from Windows to Unix |
Default permissions applied |
21 |
SCP with Symlinks (Unix to Windows) |
Transfer symlink to Windows |
Symlink may be copied as regular file |
22 |
SCP with Symlinks (Unix to Unix) |
Transfer symlink between Unix systems |
Symlink preserved |
23 |
SCP with Large Files |
Transfer >2GB file across platforms |
File transfers successfully |
24 |
SCP with Special Characters in Filename |
Transfer file with #, @, &, etc. |
Filename preserved |
25 |
SCP with Spaces in Filename |
Transfer file with spaces |
Filename preserved |
26 |
SCP with Different Timezones |
Transfer between systems in different timezones |
Timestamps preserved |
27 |
SCP with Different Locales |
Transfer between systems with different locales |
File transfers successfully |
28 |
SCP with ProxyJump |
Use ProxyJump across platforms |
File transfers successfully |
29 |
SCP with SSH Key Authentication |
Use key-based auth across platforms |
File transfers successfully |
30 |
SCP with Password Authentication |
Use password auth across platforms |
File transfers successfully |
31 |
SCP with SSH Agent |
Use SSH agent on different OS |
File transfers successfully |
32 |
SCP with IPv6 |
Use IPv6 addresses across platforms |
File transfers successfully |
33 |
SCP with IPv4 |
Use IPv4 addresses across platforms |
File transfers successfully |
34 |
SCP with Hostname Resolution |
Use DNS names instead of IPs |
File transfers successfully |
35 |
SCP with SSH Config |
Use ~/.ssh/config on Unix/macOS |
SCP uses config settings |
36 |
SCP with Windows SSH Config |
Use C:Usersuser.sshconfig |
SCP uses config settings |
37 |
SCP with Environment Variables |
Use $HOME, %USERPROFILE%, etc. |
Paths resolved correctly |
38 |
SCP with GUI Tools (WinSCP) |
Use GUI SCP client on Windows |
File transfers successfully |
39 |
SCP with GUI Tools (Cyberduck) |
Use Cyberduck on macOS |
File transfers successfully |
40 |
SCP with CLI Tools |
Use command-line SCP on all platforms |
File transfers successfully |
41 |
SCP with Docker Containers |
Transfer files to/from containers |
File transfers successfully |
42 |
SCP with Virtual Machines |
Transfer files to/from VMs |
File transfers successfully |
43 |
SCP with Cloud Instances |
Transfer files to/from AWS, Azure, GCP VMs |
File transfers successfully |
44 |
SCP with NAS Devices |
Transfer files to/from NAS |
File transfers successfully |
45 |
SCP with Raspberry Pi |
Transfer files to/from Raspberry Pi |
File transfers successfully |
46 |
SCP with Chromebook (Linux Mode) |
Use SCP from Linux shell on Chromebook |
File transfers successfully |
47 |
SCP with Remote Desktop |
Use SCP in RDP session |
File transfers successfully |
48 |
SCP with VPN |
Transfer files over VPN |
File transfers successfully |
49 |
SCP with Firewall |
Transfer files through firewall (port 22 open) |
File transfers successfully |
50 |
SCP with Antivirus |
Transfer files with antivirus running |
File transfers successfully unless blocked |
No Need for Additional Setup - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
SCP with Default SSH Installation |
Use SCP on a system with only SSH installed |
File transfers successfully |
2 |
SCP Without SCP Daemon |
No separate SCP service running |
File transfers successfully |
3 |
SCP Without FTP/SFTP Server |
No FTP/SFTP server installed |
File transfers successfully |
4 |
SCP Without Additional Ports |
Only port 22 open |
File transfers successfully |
5 |
SCP Without Manual Configuration |
No SSH config file present |
File transfers successfully |
6 |
SCP Without SSH Key Setup |
Use password authentication |
File transfers successfully |
7 |
SCP Without Host Key Pre-acceptance |
First-time connection |
Prompts for host key confirmation |
8 |
SCP Without GUI Tools |
Use command-line SCP |
File transfers successfully |
9 |
SCP Without Root Access |
Use regular user account |
File transfers successfully (within permissions) |
10 |
SCP Without Admin Privileges (Windows) |
Use SCP from non-admin account |
File transfers successfully |
11 |
SCP Without SSH Agent |
No agent running |
Prompts for password or key |
12 |
SCP Without Proxy Configuration |
No proxy settings |
File transfers directly |
13 |
SCP Without VPN |
No VPN or tunnel |
File transfers over public/private IP |
14 |
SCP Without DNS Configuration |
Use IP address directly |
File transfers successfully |
15 |
SCP Without Firewall Rules |
SSH port allowed by default |
File transfers successfully |
16 |
SCP Without NAT Rules |
Use public IP |
File transfers successfully |
17 |
SCP Without SSH Config File |
No ~/.ssh/config |
File transfers using full command |
18 |
SCP Without SCP Installed on Client |
Use OpenSSH client with SCP support |
File transfers successfully |
19 |
SCP Without SCP Installed on Server |
Use SSH server only |
File transfers successfully |
20 |
SCP Without Manual SSH Key Copy |
Enter password manually |
File transfers successfully |
21 |
SCP Without GUI SCP Client |
Use native SCP command |
File transfers successfully |
22 |
SCP Without SCP Logging |
No logging enabled |
File transfers successfully |
23 |
SCP Without SCP Configuration File |
No SCP-specific config |
File transfers successfully |
24 |
SCP Without SSH Multiplexing |
No ControlMaster setup |
File transfers successfully |
25 |
SCP Without SSH Compression |
No -C flag used |
File transfers successfully |
26 |
SCP Without SSH Port Forwarding |
No port forwarding setup |
File transfers successfully |
27 |
SCP Without SSH ProxyJump |
Direct connection |
File transfers successfully |
28 |
SCP Without SCP Wrapper Scripts |
Use raw SCP command |
File transfers successfully |
29 |
SCP Without SCP Aliases |
No shell alias defined |
File transfers successfully |
30 |
SCP Without SCP Environment Variables |
No special env vars set |
File transfers successfully |
31 |
SCP Without SCP GUI Prompts |
Use CLI only |
File transfers successfully |
32 |
SCP Without SCP Daemon Logs |
No SCP-specific logs |
File transfers successfully |
33 |
SCP Without SCP Service Restart |
No service restart needed |
File transfers successfully |
34 |
SCP Without SCP Package Installation |
Use built-in SCP from OpenSSH |
File transfers successfully |
35 |
SCP Without SCP on Remote (BusyBox) |
Use BusyBox SCP-compatible shell |
File transfers successfully |
36 |
SCP Without SCP on Embedded Device |
Use SSH-enabled IoT device |
File transfers successfully |
37 |
SCP Without SCP on NAS |
Use SSH-enabled NAS |
File transfers successfully |
38 |
SCP Without SCP on Cloud VM |
Use SSH-enabled cloud instance |
File transfers successfully |
39 |
SCP Without SCP on Docker Container |
Use container with SSH access |
File transfers successfully |
40 |
SCP Without SCP on Virtual Machine |
Use VM with SSH access |
File transfers successfully |
41 |
SCP Without SCP on WSL |
Use SCP from Windows Subsystem for Linux |
File transfers successfully |
42 |
SCP Without SCP on macOS |
Use built-in SCP |
File transfers successfully |
43 |
SCP Without SCP on Windows (OpenSSH) |
Use Windows 10+ with OpenSSH |
File transfers successfully |
44 |
SCP Without SCP on Windows (WinSCP) |
Use WinSCP GUI |
File transfers successfully |
45 |
SCP Without SCP on Android |
Use Termux with SSH |
File transfers successfully |
46 |
SCP Without SCP on iOS |
Use SSH-capable app |
File transfers successfully |
47 |
SCP Without SCP on Chromebook |
Use Linux shell |
File transfers successfully |
48 |
SCP Without SCP on Firewall-Protected Host |
SSH port allowed |
File transfers successfully |
49 |
SCP Without SCP on NAT Device |
Use port forwarding |
File transfers successfully |
50 |
SCP Without SCP on Isolated Network |
Use direct SSH access |
File transfers successfully |
Script Friendly - Testcases
# |
Test Case |
Description |
Expected Result |
---|---|---|---|
1 |
SCP in Shell Script |
Use SCP in a .sh script |
File transfers successfully |
2 |
SCP in Cron Job |
Schedule SCP via cron |
File transfers at scheduled time |
3 |
SCP with Variables |
Use shell variables for paths and hosts |
Variables resolved correctly |
4 |
SCP in Loop |
Transfer multiple files in a loop |
All files transferred |
5 |
SCP with Wildcards in Script |
Use *.log in script |
All matching files transferred |
6 |
SCP with Logging |
Redirect SCP output to log file |
Logs created successfully |
7 |
SCP with Error Handling |
Use if condition to check SCP success |
Script handles success/failure |
8 |
SCP with Exit Codes |
Check $? after SCP |
Exit code reflects success/failure |
9 |
SCP with SSH Key |
Use key-based auth in script |
No password prompt |
10 |
SCP with Password via SSH Agent |
Use SSH agent to avoid password prompt |
Script runs non-interactively |
11 |
SCP with expect Script |
Automate password entry using expect |
File transfers successfully |
12 |
SCP with Background Execution |
Run SCP in background (&) |
Script continues execution |
13 |
SCP with timeout |
Use timeout command to limit SCP duration |
SCP terminates after timeout |
14 |
SCP with trap |
Use trap to handle interruptions |
Cleanup or logging triggered on signal |
15 |
SCP with set -e |
Exit script on SCP failure |
Script stops on error |
16 |
SCP with set -x |
Enable debug output |
SCP commands echoed to terminal |
17 |
SCP with scp -q |
Suppress SCP output |
Quiet transfer |
18 |
SCP with scp -v |
Enable verbose output |
Detailed logs shown |
19 |
SCP with scp -r |
Recursive directory transfer in script |
Directory copied |
20 |
SCP with scp -p |
Preserve attributes in script |
Timestamps and permissions preserved |
21 |
SCP with scp -C |
Use compression in script |
Faster transfer for large files |
22 |
SCP with scp -l |
Limit bandwidth in script |
Transfer speed throttled |
23 |
SCP with scp -P |
Use custom port in script |
File transfers successfully |
24 |
SCP with scp -i |
Use identity file in script |
Authenticates using specified key |
25 |
SCP with scp -o |
Pass SSH options in script |
Custom SSH behavior applied |
26 |
SCP with scp -o StrictHostKeyChecking=no |
Disable host key prompt |
Script runs non-interactively |
27 |
SCP with scp -B |
Batch mode SCP |
No prompts during transfer |
28 |
SCP with scp -3 |
Transfer between two remote hosts |
File routed through local machine |
29 |
SCP with scp -T |
Disable strict filename checking |
Allows remote command execution |
30 |
SCP with scp -r -p |
Combine recursive and preserve flags |
Directory copied with attributes |
31 |
SCP with scp -q -C |
Combine quiet and compression flags |
Silent and fast transfer |
32 |
SCP with scp -v -i |
Combine verbose and identity file |
Debug output with key-based auth |
33 |
SCP with scp -o ConnectTimeout=5 |
Set connection timeout |
Fails if not connected in time |
34 |
SCP with scp -o UserKnownHostsFile=/dev/null |
Avoid host key storage |
No known_hosts file updated |
35 |
SCP with scp -o LogLevel=ERROR |
Suppress warnings |
Only errors shown |
36 |
SCP with scp -o PreferredAuthentications=publickey |
Force key-based auth |
Password prompt avoided |
37 |
SCP with scp -o IdentityFile=~/.ssh/id_rsa |
Specify key file |
Authenticates using given key |
38 |
SCP with scp -o ProxyCommand |
Use proxy command |
File transfers via proxy |
39 |
SCP with scp -o ProxyJump |
Use jump host |
File transfers via intermediate host |
40 |
SCP with scp -o Compression=yes |
Enable SSH compression |
Faster transfer |
41 |
SCP with scp -o StrictHostKeyChecking=ask |
Prompt for unknown host |
User prompted once |
42 |
SCP with scp -o ServerAliveInterval=60 |
Keep connection alive |
Long transfers stay active |
43 |
SCP with scp -o TCPKeepAlive=yes |
Enable TCP keepalive |
Prevents timeout |
44 |
SCP with scp -o ControlMaster=auto |
Use SSH multiplexing |
Reuses SSH connection |
45 |
SCP with scp -o ControlPath |
Define control socket |
Multiplexing works across sessions |
46 |
SCP with scp -o ControlPersist=10m |
Keep SSH session alive |
Faster repeated transfers |
47 |
SCP with scp -o User=username |
Specify user in script |
Authenticates as specified user |
48 |
SCP with scp -o Port=2222 |
Specify port via SSH option |
Connects to custom port |
49 |
SCP with scp -o BatchMode=yes |
Disable password prompts |
Script fails if key not available |
50 |
SCP with scp -o PreferredAuthentications=password |
Force password auth |
Prompts for password |
Reference links