LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-10-2016, 09:31 AM   #1
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Rep: Reputation: Disabled
Question Automate backup my files on online net FTP


Hi

I got a server from Onilne net and i got with it 100Gb ftp backup space....

I found a tutorial here for how to create the backup and move it on the ftp:

Code:
https://documentation.online.net/en/dedicated-server/tutorials/backup/configure-backup/start
But that takes the backup of files and backup of the database and move them....

What i want is more easy than that..... Just to transfer the contents of the folder /backup on ftp as i have already prepare everything there with my script....

Anyone using that method or have any idea?

Actually a bash script may do that connect to ftp and transfer files?

Thanks
 
Old 09-11-2016, 12:59 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
FTP is past its best-used-by date which expired in the 1990's. It transfers the username, password, and all data unencrypted which can be intercepted by anyone on the same network as you or your destination, or anywhere in between.

Can you use "rysnc", "sftp", or "ssh" instead? "rsync" with keys is they way I'd use. But there is also a batch mode for "sftp" which can be used in scripts.
 
Old 09-11-2016, 09:07 AM   #3
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
Rsync is cool to use but how can i pass ftp login info to it?
 
Old 09-11-2016, 09:18 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Quote:
Originally Posted by bmxakias View Post
Rsync is cool to use but how can i pass ftp login info to it?
I wouldn't recommend doing anything with FTP except uninstalling it.

The pre-requisite for automated "rysnc" is SSH with key-based authentication. There are a lot of tutorials on that, but the gist is you make a key pair and set the public key on the server and keep the private key on your client.

If you can, set up your script so it takes advantage of the ssh-agent utility to keep the keys in memory so you can use a strong passphrase.

Once you have SSH with key-based authentication you can just tack it onto "rsync"

Code:
rsync -av -e "ssh -i /home/mbxakias/.ssh/key1_rsa" /source/directory/ remotehost.example.com:/destination/directory/
You can also put other SSH options inside the "rsync" -e option, such as -p for a different port.
 
Old 09-11-2016, 02:56 PM   #5
bmxakias
Member
 
Registered: Jan 2016
Posts: 254

Original Poster
Rep: Reputation: Disabled
Can i add my key key1_rsa to an ftp space?

Also how can i mount it?

Quote:
[root@server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 454G 16G 415G 4% /
devtmpfs 48G 0 48G 0% /dev
tmpfs 48G 0 48G 0% /dev/shm
tmpfs 48G 65M 48G 1% /run
tmpfs 48G 0 48G 0% /sys/fs/cgroup
/dev/sda1 380M 100M 256M 29% /boot
tmpfs 9.5G 0 9.5G 0% /run/user/0
 
Old 09-12-2016, 03:40 AM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
Quote:
Originally Posted by bmxakias View Post
Can i add my key key1_rsa to an ftp space?

Also how can i mount it?
The public key usually has .pub appended to the name. So if you generate the keys like this:

Code:
ssh-keygen -t rsa -b 4096 -C "some comment about intended usage" -f /home/bmxakias/.ssh/key1_rsa
You'd want to use "ssh-copy-id" to transfer key1_rsa.pub over to your remote machine. Again there are many tutorials about how to get the public key part of your key pair over to your remote machine.

If you mean mount in the traditional sense, then you can use "sshfs" which will mount over SFTP. Or if you just mean log in to the remote machine and muck around, then you have ssh or sftp built in to your current Linux or BSD (incl OS X) system.

Code:
cd /home/bmxakias/Data/
sftp bmxakias@farawaymachine.example.com
If you need a graphical client for SFTP then you have many graphical SFTP clients to choose from, some of which are included by default. Nautilus, for example, will show the remote folder as if it were local even though you may be accessing it over SFTP.

But first make sure you can connect with SSH / SFTP and then get keys working. Then look at "sshfs" or "rsync"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate FTP / Scripting FTP Transfers files from linux to windows m/c ashishshukla Programming 5 05-26-2016 09:10 AM
how do i automate backup of files on NAS ? JackDinn Linux - Newbie 20 06-17-2015 06:19 PM
seeking "intra-net" web storage and online backup SaintDanBert Linux - Software 4 12-13-2009 07:10 PM
Perl - Net::FTP - download all PDF files noir911 Programming 4 07-03-2009 11:25 AM
listing files Net::FTP kshkid Programming 16 05-23-2007 05:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration