Synchronization by `` lftp
9 maggio 2008, 18:46 Backup , Open Source , Shell , System , Tips & Tricks May 9, 2008, 18:46
This week has been very, very hard ... but I can not let it end without having gone online at least a small, miserable, insignificant tip!
So to do things on the fly, I tell you how I make the synchronization of a website that I have developed locally with the copy that is published in a directory of your FTP space.
I state that this is not the way I work as normal: a good child of the 70s I edit the code directly online, not in production, but online (bash). This week I happened, however, having to hack the website of a client who has placed at my disposal only and exclusively on its FTP account. So I started developing a local copy of your website and keep synchronized with the online version of a single, simple, wonderful command:
lftp -u 'username,password' ftp.mydomain.com -e "set ftp:ssl-protect-data true;mirror --reverse /home/ivan/test test; exit;"
In other words:
- username: the username for the FTP
- Password: The password associated with the username of ftp
- ftp.mydomain.com: the host FTP account
- / Home / ivan / test: the local folder (without trailing slash)
- tests: the remote folder (ie one where there is posted on website)
Note the option "set ftp:ssl-protect-data true" that protects the authentication and SSL FTP through the "mirror-reverse" that allows you to synchronize downloads rather than uploads.
Needless to say, with the same command you can keep a remote backup to a local directory, although this type of thing we recommend the use of `rsync` that does everything through `ssh`.
Nothing more, nothing less. Happy weekend!















May 12, 2008 at 12:13
I arrived by chance in the pages of your blog more or less a month ago. Some of your posts show a thorough knowledge of Debian GNU / Linux. You can submit the problems that beset our infrastructure and get a quote for their resolution? Contact me. Hello.
May 12, 2008 at 12:39
Please fill out the form at the page "Contact". As for the analysis and resolution of problems to which you refer: no problem, it's my job
Good day!
March 7th, 2009 at 19:40
I tried the command shown in this post and did not work.
here is the version with which I managed to upload:
lftp-c 'open-u username, password ftp://sitoftp.net/ set; ftp:ssl-protect-data true; mirror-reverse / directory / source directory_destinazione_sul_server; exit '
March 9, 2009 at 12:45
Thanks for the clarification Stephen! I do not know what's wrong in the command that I quoted above, but maybe it's just a typo: I see that in fact the argument to-u starts with a simple apex and ends - horror! - With an apostrophe ...
I fix this soon ...