Tag Archives: ftp

How to mirror a FTP folder and subfolders – lftp

I had to copy almost 10Gb from one server to another.
Usually I use rsync but this time the user that I have on the remove server is just an FTP user.

My first and dumb option was to use wget to fetch the content! *DUMB!*.
After a few hours/day… I got Write failed: Broken pipe.

OK!, I’v decided to use lftp.
So… I needed to install simply by doing….

apt-get install lftp

Let’s go!

Connect to the server

lftp storage.domain.org

Enter the username

user userexport

then enter the password…

and the the magic command!

mirroc -c -p

-c – resume option
-p – download files in parallel

HOORAY!, thats kinda it.

lftp [email protected]:~> mirror -c -p
Total: 2184 directories, 97729 files, 0 symlinks
New: 25548 files, 0 symlinks
9900721069 bytes transferred in 2750916 seconds (3.5 KiB/s)
lftp [email protected]:/>

Linux add user and change its home dir

I usually need to create Linux users for FTP access…
FTP is unsecure, we should use sftp bla bla blaa…

Add user
useradd username
Set/change password
passwd username
Set user’s home dir
usermod -m -d /new/path/ username

This way we will set the new path (/new/path/) to the user named username.

-m defines that content from the old home directory will be mobed to the new one.
-d the new home dir’s path

 See user’s information
finger username