≡ Menu

FTP Server

Download of the day: OpenBSD 4.6 CD ISO Images

OpenBSD 4.6 has been released and available for download from the official website. OpenBSD is well known for record of more than ten years with only two remote holes in the default install. The OpenBSD is widely known for the quality open source code and documentation, uncompromising position on software licensing, and focus on security and code correctness.
[click to continue…]

Vsftpd Set Download Only Anonymous Internet Server

This example shows how you might set up a large internet facing FTP site for distributing file or software updates. The emphasis will be on security and performance. VSFTPD will make sure only world-readable files and directories are served to the world via anonymous / ftp account. You force to originates FTP port connections from a secure port - so users on the FTP server cannot try and fake file content. You will hide the FTP server user IDs and just display ftp in directory listings. This is also a performance boost. Set a 40000-60000 port range for passive connections. This will help firewall setup.
[click to continue…]

Linux Create An FTP User Account

Now your FTP server is up and running. It is time to add additional users to FTP server so that they can login into account to upload / download files. To add a user called tom and set the password, enter:
# adduser -c 'FTP USER Tom' -m tom
# passwd tom

Now tom can login using our ftp server. Make sure the following is set in vsftpd.conf

local_enable=YES

Restart the vftpd:
# service vsftpd restart

However, I recommend setting virtual FTP user account to increase server security.

You can use ncftpget command to download entire ftp directory and sub directories from remote ftp server. Let us say you would like to download /www-data directory and all subdirectories inside this one from ftp.nixcraft.net server. You need to use ncftpget command.

Install ncftp client

ncftp client software can be downloaded from http://www.ncftp.com/ncftp/ and works with FreeBSD, Solaris and all most all UNIX variant. You can also run command as follows to install ncftp:
$ sudo apt-get install ncftp

FTP get directory recursively

ncftpget is Internet file transfer program for scripts and advance usage. You need to use command as follows:
$ ncftpget –R –v –u "ftpuser" ftp.nixcraft.net /home/vivek/backup /www-data
Where,

  • -R : Copy all subdirectories and files (recursive)
  • -v : Verbose i.e. display download activity and progess
  • -u "USERNAME" : FTP server username, if skipped ncftpget will try anonymous username
  • ftp.nixcraft.net : Ftp server name
  • /home/vivek/backup : Download everything to this directory
  • /www-data : Remote ftp directory you wish to copy

If you get an error which read as follows:

tar: End of archive volume 1 reached
tar: Sorry, unable to determine archive format.
Could not read directory listing data: Connection reset by peer

Then add –T option to ncftpget command:

$ ncftpget –T –R –v –u "ftpuser" ftp.nixcraft.net /home/vivek/backup /www-data

Where,

  • -T : Do not try to use TAR mode with Recursive mode