Network file movement ranges from one-time copies to continuously mounted shares and synchronized directory trees. Choose a method based on direction, data size, update frequency, identity model, network trust, metadata requirements, and whether clients need live shared access.
Network Sharing · Lesson 1
File Sharing Overview
Learn how to choose and safely perform an SSH-based file transfer with scp.
Choosing a Transfer Method
scpor SFTP provides an SSH-authenticated copy or interactive transfer.rsyncefficiently reconciles directory trees locally or over a transport such as SSH.- NFS presents server exports as mounted filesystems, commonly between Unix-like hosts.
- SMB, implemented by Samba on Linux, supports shared access across many operating systems.
- HTTP can provide simple downloads but is not a general mounted filesystem.
A copy is not automatically a backup. A backup design also needs independent retention, restore testing, integrity checks, and protection from the same deletion or compromise.
Which tool is suitable for a one-time file copy through SSH?
Understanding scp Paths
The general form is scp SOURCE DESTINATION. A remote operand commonly uses user@host:path:
$ scp -- report.txt alice@example.net:/srv/incoming/
$ scp -- alice@example.net:/srv/outgoing/result.txt ./result.txt
The first command pushes a local file; the second pulls a remote file. A colon distinguishes the remote host from its path. Quote paths that contain shell-sensitive characters and avoid ambiguous untrusted filenames.
In an scp pull, where does the remote specification appear?
Copying a Directory
Use recursive mode for a directory tree:
$ scp -r -- project/ alice@example.net:/srv/incoming/
Before copying, inspect data size, symlinks, permissions, ownership requirements, free space, and destination naming. SCP is not a synchronization policy; repeated directory copies can leave files at the destination that no longer exist at the source.
What does scp -r request?
Verifying Identity and Results
SSH host-key verification protects against connecting to the wrong server. Treat a changed host key as an event to verify through a trusted channel rather than bypassing the warning. Use least-privilege accounts and key handling appropriate to the environment.
After transfer, verify exit status, expected files, sizes, metadata, and—when integrity requirements demand it—independently calculated hashes at both ends. Confirm that the destination application can actually read the data.
What should you do when SSH reports an unexpected changed host key?
Lesson complete
You finished File Sharing Overview
You can now select and verify a secure one-time network file copy.
Match the sharing method to access and retention needs.
Read local and remote
scpoperands by source and destination.Use recursive mode deliberately for directory trees.
Verify server identity, transfer results, and destination usability.
Keep your learning progress
Create a free account to save this lesson and continue learning on any device.
Create a free account