There’s a few ways to transfer files between Linux machines though one of the easiest is to use SCP (secure copy protocol), to my knowledge all major Linux distributions support SCP so this short tutorial shouldn’t be limited to a single distribution.
First you’re going to need to upload your recipients private key to the machine you want to transfer files from, on Windows I’m going to use a program called WinSCP, once uploaded you need to use chmod command (example below) to secure the key so only the owner is able to use it.
sudo chmod 600 yourprivatekey
You can use the command below to ensure the chmod worked, you may find a chmod calculator website useful.
ls -all yourprivatekey
Now all we need to do is use the SCP command using our private key to transfer our file over to the receiving server, remember to replace the values in red with your own.
scp -i /home/yourprivatekey filetosend email@example.com:~
Now if you login to the recipient server you should see the file you transferred, in my case the test.txt file will be sitting in my home directory at /home/damien
If you’re running into any issues transferring files here’s a few thing’s to check.
- Firewall on both machines has port 22 open
- Your sending machine’s IP address hasn’t been banned by the recipient
- Your login credentials for the recipient are correct
- You have folder permission for the receiving directory