Linux SCP: Securely Transfer Files and Folders Over SSH
HardReset.InfoJanuary 1, 20269 min35 views
7 connectionsΒ·10 entities in this videoβUnderstanding SCP and SSH
- π‘ SCP (Secure Copy) is a command-line tool for transferring files and directories securely over SSH.
- π To use SCP, SSH must be installed and running on your Linux system.
Installing and Enabling SSH
- π» To check if SSH is installed, use the command:
sudo systemctl status ssh. - βοΈ If SSH is not installed, install it using:
sudo apt install openssh-server. - β
After installation, enable and start the SSH service with:
sudo systemctl enable --now ssh. - π Verify that SSH is active and running with
sudo systemctl status ssh.
Network Configuration and IP Address
- π When using SCP on virtual machines, it's crucial to set the network adapter to Bridge mode instead of NAT.
- β οΈ NAT mode can cause IP address issues (e.g., starting with 10.0.0.x) that prevent SCP from working correctly.
- IP addresses in Bridge mode typically start with
192.168.x.x. - π You can find your machine's IP address using a command like
ip aorifconfig.
Transferring Single Files with SCP
- π Create a test file using
echo 'SCP test file' > test.txt. - π€ The basic SCP syntax for transferring a file is:
scp <local_file> <username>@<IP_address>:<destination_path>. - π You will be prompted to authenticate, usually by entering your password or using SSH keys.
- β After successful transfer, verify the file exists at the destination.
Transferring Folders with SCP
- π To copy an entire folder, use the recursive option with SCP:
scp -r <local_folder> <username>@<IP_address>:<destination_path>. - π This command copies the folder and all its contents.
- β Navigate to the destination directory to verify that the folder and its files have been transferred correctly.
Knowledge graph10 entities Β· 7 connections
How they connect
An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.
Hover Β· drag to explore
10 entities
Chapters4 moments
Key Moments
Transcript35 segments
Full Transcript
Topics14 themes
Whatβs Discussed
SCPSSHSecure CopyFile TransferLinuxOpenSSH ServerCommand LineVirtual MachinesBridge AdapterNATIP AddressRecursive CopyPassword AuthenticationSSH Keys
Smart Objects10 Β· 7 links
ProductsΒ· 5
MediasΒ· 3
ConceptΒ· 1
LocationΒ· 1