Skip to content

Femputer. Posts

Transferring files using SSH

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.

How to configure mod_remoteip

If you use Cloudflare or another reverse proxy service you’ve probably noticed that your Apache access logs are only recording Cloudflare IP addresses and not real IP addresses of connecting visitors, Cloudflare used to have their own plugin for older versions of Apache and operating systems though as of Ubuntu 18.04 and Debian 9 they’ve decided to stop supporting the Apache module.

The replacement is a module called “mod_remoteip” which is actually extremely easy to install and configure though it did initially take me hours to figure our how to configure the module correctly.

Initial Server Setup: Ubuntu 18.04

Before we can even create our Ubuntu server we need to generate what are called SSH keys which allow users connect to their servers remotely and securely, this is where you need to download and install the program Putty, once Putty is installed you need to open a program which came bundled with Putty called Putty Key Generator, this program allows you to generate a long private key which is what you’re going to be using to connect to your Ubuntu 18.04 server.