The most secure server data transfer? - linux

I'm running an Ubuntu Server somewhere, 24/7. It's used to host a webpage, a shoutcast radio, some other stuff. I'm planning to buy a Raspberry Pi 1B to use it as a "backup" server, in the following way :
Whenever the Raspberry Pi is powered up and connected to the internet, it checks if the server is online (by pinging it)
If it is, it copies via internet a precise folder from the server and backs it up on the Raspberry Pi drive. Then the Raspberry Pi powers off / reboots once the transfer is completed.
As you can see the "via internet" part is emphasized, as I don't know which data transfer method to use to make this the most simplest / stable (easy to automatize via shell scripts, not going to crash or fail) and more secure (no one can intercept and read the data which is transferred between the two machines) way. If it's slow, no problem, just want it done via automated script.
So what's the best way to do that ? WGET a HTTPS page of the server from the RPi with some credentials ? Automated SFTP ? Third-server-based transfer ? Anything else ?
Edit : People seem to downvote this post. This is fine, but I'd really appreciate to know why, so don't hesitate to comment if you disapprove to tell me what I did wrong. Thanks.

I would suggest to use rsync for that kind of stuff.
How to use rsync:
https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps#how-to-use-rsync-to-sync-with-a-remote-system
It also works with ssh-keys so you do not need a password which makes it great for backups.

Related

Website for Minecraft Server Wake Up on Lan

a friend of mine has a little server rig. He hosts a Minecraft-Server on it over his router at home. Because he doesn't wanna run it 24/7, I had an idea and I wanna ask if its possible.
My idea was to create a little website (world wide web) to start the server over wake up lan. I would run the website on my Rasperry Pie, which would be online 24/7.
Is that possible? If so, what should I learn to make the website safe, e.g. password?
Im not very familiar with website coding, but Im pretty good with software development with C-Based languages.
Im non-native speaker, so please excuse any grammar mistakes.
Thank you.
Wake on LAN works using broadcast packets, so in the local network only
And by default your router blocks those packets from the outside
You will have a bad time trying to make that works
In your case, the best choice would be to pay a little server online for your server

access to a raspberry pi from all over the world without dyndns

first of all i wanted to clearify, that i'm not asking, how to access a raspberry pi from the internet. I know, that I have to use a DynDNS or the IPv4 if it won't change. But I can't use this.
So I will explain my problem:
A friend of mine and me are working on a project. We are creating a automatic watring system for gardens or plantations and we have a apache on the pi, so you can access the pi from the home-network. But we also want to access the pi from outside, but without using a DynDNS, because we want to make it marketable, so you can't give every pi a DynDNS.
At networks, where the IPv4 won't change it is not a problem, but usually the internet provider change your IPv4 nearly every day. We also thougt of building a own small server with old PC-Components of our parents, but we don't know how to deal with the changing IPv4. Theoretically we could build a own small server if it is a solution.
So I wanted to ask you, how to access a raspberry pi with changing IPv4 without DynDNS.
(Sorry for my bad englisch)
Your bigger problem is that 99% of consumer devices are behind a router. You will need a solution that opens a connection to your service and waits for commands. This concept exits with tools like netcat or ngrok.

Windows program to communicate with Virtualbox

I am wondering if it is possible to write a program on Windows that communicates with a program within a Linux Virtualbox on the same machine. If this is possible, what is the best approach to doing this? Is there a way to do this without using the internet to communicate?
I found instructions showing how you could potentially use SSH, but I have never tried doing this before, so I do not know if using SSH to communicate would be the best option.
I was going to put this as a comment to a very vague question, but then it got too long.
It depends what you mean by "communicate"....
If the Windows machine should start a program on the Linux VM, you probably want plink.exe - see here.
If you want to transfer whole files, you probably want scp or FTP or FileZilla - see here.
If you want to send small messages occasionally, maybe netcat, also known as nc - see Netcat Cheatsheet here.
If you want full-on, high speed, continuous messages, maybe sockets or some messaging protocol like mqtt.
If you want to share data structures, like lists, queues or sets, you could allow both Windows and the Linux machine to access a shared Redis database - see here.
Or maybe it is enough to share a filesystem between the two machines - in which case you can make a Shared Folder in VirtualBox on your host and the VM can just mount that and read/write it. See diagram:

To transfer files to device using FTP, is it necessary to have a server running on it?

For some time now I've been trying to send files to a Embedded Linux device via FTP without success. I even previously put a question in SO talking about my problem, and I still haven't got any further in solving it.
One thing I noticed, though, is that most FTP examples in the web includes a server-client relationship; the client connects itself to the server that is constantly listening in some IP-Port and the file transfer begins. Now when studying the examples using QNetworkAcessManager to send a file (generally to HTTP), they never mentioned the "other side requirements", what is leading me to believe I'm missing the necessary FTP server running in my Embedded Linux device.
So my question is more like a confirmation of my suspicions: if I want to transfer a file from my Desktop to my device using FTP, do I need to have a FTP server constantly running on that device? If yes, how that should change my code? For instance, should I abandon QNetworkAcessManager in favour of a QTcpClient usage? IOW what else should I know to make the file transfer system work using Qt? (In fact should I even bother myself with FTP at all instead of just using a normal QTcpServer?)
FTP is a protocol with 2 parties, the client and the server. Both must comply to the specification of FTP before file transfer can take place.
So yes there has to be a FTP deamon (the server) running the on the other device.
It doesn't have to run constantly just whenever you want to transfer files.

Use External URL to point to Local Server, Locally

I want to be able to access my raspberry pi locally using the dynamic dns name I have setup but I am having some trouble.
Example:
pi.domain.com - this can be accessed from outside the network fine, it updates the IP dynamically etc.
When accessing pi.domain.com from inside my local network, the same one the RPi is on, I cant do it (timeout).
If I use raspberrypi/ or 192.168.1.72 I can access it from my network internally, :22 access etc.
My question is: would it be possible to configure something so that when I am local to the RPi, I can use pi.domain.com and it will resolve to raspberrypi/?
Thanks,
Adam
Pretty simple solution I'm afraid. All I did was port forward :80 to my RPi in my routers settings, boom. Thought it would be a bit harder than that... I won't delete this just encase anyone else doing the same comes across this.
I thought that as the Pi was in the routers DMZ it would have done this automatically... oh well!

Resources