To transfer files from PC2 to PC1 using SSH, you can use the scp (secure copy) command. Here’s how you can do it:
For Files
From PC1 (where you are logged in via SSH)
Open a Terminal:
- If you're on Windows, you might be using an SSH client like PuTTY or Windows Terminal.
- If you're on Linux or macOS, open your terminal application.
Use
scpCommand:- The basic syntax of
scpis:scp [options] [source] [destination]. - In your case, since you are on PC1 and want to copy files from PC2 to PC1, the command will run from PC1.
- The basic syntax of
Copy from PC2 to PC1:
- Replace
[username],[pc2_ip_address], and[file_path_on_pc2]with the appropriate values. [username]@[pc2_ip_address]:[file_path_on_pc2]specifies the file on PC2.[destination_path_on_pc1]specifies where to save the file on PC1.
bashscp [username]@[pc2_ip_address]:[file_path_on_pc2] [destination_path_on_pc1]Example:
bashscp user@192.168.1.2:/home/user/file.txt /home/localuser/- This command will copy
file.txtfrom/home/user/on PC2 to/home/localuser/on PC1.
- Replace
Authentication:
- When you run the
scpcommand, you may be prompted to enter the password for the user on PC2 (unless you've set up SSH keys for passwordless login).
- When you run the
Transfer Complete:
- Once the transfer is complete, you should see a confirmation message indicating the transfer details.
Additional Notes:
- Permissions: Ensure the user on PC2 has necessary permissions to read the file you want to copy.
- Firewall: If either PC1 or PC2 is behind a firewall, ensure that SSH (port 22 by default) is allowed through.
- SSH Keys: For automated or passwordless transfers, consider setting up SSH keys between PC1 and PC2.
For Directory
scp -r user@192.168.1.2:/home/user/file.txt /home/localuser/
just add -r for directory copying.
From Kali Linux to Windows File sharing
scp -r maverick@10.71.77.6:/home/maverick/Desktop/kali-banner Maverick@10.71.77.2:/F:/
Comments
Post a Comment