wget
Use wget
as follow
wget --mirror --no-parent --user=<ftpuser> --password=<ftppassword> ftp://server/<directory path>
It will download the whole directory recursively.
Option --no-parent
Do not ever ascend to the parent directory when retrieving recursively. This is a useful option, since it guarantees that only the files below a certain hierarchy will be downloaded.
So the following
wget --mirror --no-parent --user=<ftpuser> --password=<ftppassword> ftp://server/home/username/public_html
will only download directory structure starting with public_html
.
Directory path
You should login ftp server once to confirm the path. Depending on how ftp server is configure, the path may actually start within the home directory. In that case, the directory path will be /public_html
only.
Changing Directory Ownership
Change the user and group of the downloaded directory with following command
chown -R <user>:<group> public_html
If you want to change to user www-data
and group www-data
chown -R www-data:www-data public_html
You may also want to remove write permission for others
/anybody
chmod -R o-w public_html
-R = recursively
Category (can assign multiple without space)
u = user
g = group
o = others = anybody
Add/Remove
"-" sign = remove permission following the sign, from category before the sign
"+" sign = add permission following the sign, to category before the sign
Permission (can assign multiple without space)
r = read permission
w = write permission
x = execute permission
Example
ug+w = add write permission to user and group
ugo-wx = remove write and execute permission from user, group and others