creating a ftp server with linux mint 11

Go down

creating a ftp server with linux mint 11

Post by jamied_uk on 7th October 2011, 12:59

How to setup an FTP server on Linux for your LAN

All operating systems have an FTP client program in order to access ftp sites, but not all have ftp server capabilities activated by default. In this article I am going to show you how to setup an FTP server in Linux. The server is going to be accessible only in your Local Area Network, as I will not go into details about setting up a router. In addition, it is going to feature anonymous and user accounts. Since the server is going to reside in a LAN only, I am not going to implement any security features. However, this should not be the case for any professional application! Last but not least, I implemented the following in Ubuntu 11.04 32-bit and Linux Mint 11 64-bit. In both cases it was a success

Installing the FTP server

There are many options as far as ftp server software is concerned. In this guide, I used vsftpd. To install it, open a terminal window and type:

sudo apt-get install vsftpd

vsftpd Installation

Password is going to be asked and a verification for the files to be downloaded. As soon as vsftpd is installed, the deamon process will start (as you can see in the picture above).

Setting Up the FTP server

All the settings of the FTP server are stored in a configuration file: /etc/vsftpd.conf . So to make changes one needs to open the file with administrator priviledges, basically type in a terminal window

sudo gedit /etc/vsftpd.conf

  1. In this tutorial we need to enable anonymous ftp access. Find the line that says: “anonymous_enable=NO” and change it to “anonymous_enable=YES”.
  2. We need to set a banner that the FTP server will display to anyone who logs in. Find the line that says: “ftpd_banner” and write the message you want it to show, like: “ftpd_banner=Welcome to EOL MAGAZINE FTP service!”
  3. If your linux box has user accounts set up, each user can log in with their username/password and they will be transferred to their home directory. The anonymous users can log in with username->anonymous and password->. The anonymous users are transferred to the folder “/srv/ftp/”. If you want to change that, you have to add the following line somewhere in the vsftp.conf: anon_root=. For reasons of making things clear let’s assume I entered the line “anon_root=/srv/ftp/”, thus I will get transferred to the default directory. The directory where a user is transferred is called root directory.
  4. To share files, one can copy them to the root directory, but that creates duplicates with the original files and occupies extra hard disk space. Alternatively, one can mount their shares into folders inside the root directory!
  5. When you are done with the configuration, open a terminal and type

  6. Code:
    sudo restart vsftpd

  7.  to apply the new configuration.

Mounting Shares

If you want to mount the shares automatically whenever the system starts, you have to edit the /etc/fstab file.

  1. Open a terminal and go to the root directory of your ftp server, in this case /srv/ftp/ with the command “cd /srv/ftp”. Create two folders named Primary and Secondary:

  2. Code:
    sudo mkdir Primary       
    sudo mkdir Secondary

  1. Now edit

    sudo gedit /etc/fstab


  2. If you want to add your hard drives sdc1 and sdd1 add at the end of the file the following lines: “/media/sdc1 /srv/ftp/Secondary none bind 0 0″ and “/media/sdd1 /srv/ftp/Primary none bind 0 0″. Save and restart the computer to mount the drives in the folders.

/etc/fstab Configuration

[size="1"] Alternatively you can mount it without restarting, but the setting will be lost when you restart the computer. To do so, open a terminal and type: “sudo mount –bind /media/sdc1 /srv/ftp/Secondary” and “sudo mount –bind /media/sdd1 /srv/ftp/Primary”
 Adding User accounts for the FTP server

[size="1"] To add a new user account you just need to create a new user in your linux box. The command is: “sudo adduser ”. The system will create the new home directory for the user and also ask for a password and some details. The details are not obligatory to enter while the password is.

adduser example

 The FTP server is ready! To initiate a connection you have to know the ip address of the server (ifconfig command), for example . Open a terminal and type: “ftp″. To log in as a user enter the user credentials, else enter anonymous as username and as password. Alternatively, open your web browser and type in the address bar: ”″ and a prompt for username/password will emerge

[size="1"] As for performance, I achieved 500 kbps over wifi connection (both computers), away from the access point. Not bad! Enjoy your new FTP server!

Still need help?

ftp server is used to transfer files between server and clients. All major operating system supports ftp. ftp is the most used protocol over internet to transfer files. Like most Internet operations, FTP works on a client/ server model. FTP client programs can enable users to transfer files to and from a remote system running an FTP server program.
Dear visitor this article is written for RHEL 5. We have updated version of this article for RHEL6. If you are looking for RHEL6 please check this article. How to configure FTP Server in RHEL6.
Any Linux system can operate as an FTP server. It has to run only the server software—an FTP daemon with the appropriate configuration. Transfers are made between user accounts on client and server systems. A user on the remote system has to log in to an account on a server and can then transfer files to and from that account's directories only.
A special kind of user account, named ftp, allows any user to log in to it with the username “anonymous.” This account has its own set of directories and files that are considered public, available to anyone on the network who wants to download them.
The numerous FTP sites on the Internet are FTP servers supporting FTP user accounts with anonymous login. Any Linux system can be configured to support anonymous FTP access, turning them into network FTP sites. Such sites can work on an intranet or on the Internet.
Configuring the ftp Server
The vsftpd RPM package is required to configure a Red Hat Enterprise Linux system as an ftp server. If it is not already installed, install it with rpm commands as described in our pervious article. After it is installed, start the service as root with the command service vsftpd start . The system is now an ftp server and can accept connections. To configure the server to automatically start the service at boot time, execute the command chkconfig vsftpd on as root. To stop the server, execute the command service vsftpd stop. To verify that the server is running, use the command service vsftpd status.
Configure vsftpd server
In this example we will configure a vsftpd server and will transfer files from client side.
For this example we are using three systems one linux server one linux clients and one windows xp clients. To complete these per quest of ftp server Follow this link
Network configuration in Linux

  • A linux server with ip address and hostname Server
  • A linux client with ip address and hostname Client1
  • A window client with ip address and hostname Client2
  • Updated /etc/hosts file on both linux system
  • Running portmap and xinetd services
  • Firewall should be off on server

We suggest you to review that article before start configuration of ssh server. Once you have completed the necessary steps follow this guide.
Three rpm are required to configure ssh server. vsftpd, portmap, xinetd check them if not found then install

Now check vsftpd, portmap, xinetd service in system service it should be on
Select System service from list



Now restart xinetd and portmap and vsftpd service

To keep on these services after reboot on then via chkconfig command

After reboot verify their status. It must be in running condition

Create a normal user named vinita

Login for this user on other terminal and create a test file

On Linux client
ping from ftp server and run ftp command and give username and password

after login you can download files from the specified directories
Most commonly commands used on ftp prompt are
put To upload files on server
get To download files from server
mput To upload all files
mget To download all files
? To see all available command on ftp prompts
cd To change remote directory
lcd To change local directory.

On window clients
Now go on window clients and create a file. copy con command is used to create files on window. To save use CTRL+Z

Now ping from ftp server and invoke ftp session from server, login from user account and download as well as uploads files

Enable root account for ftp session and set permission on user
By default on vsftpd server root account is disable. You cannot login from root account.

Now we will enable root account for ftp session and same time we will disable our normal user vinita to use ftp sessions.
open file /etc/vsftpd/ftpusers . Users whose name are set in this file will not allowed to login from ftp.

By default this file have an entry for root that why root are not allowed to use ftp. remove root from list and add user vinita

Now remove entry form /etc/vsftpd/user_list files. Users whose names are set in this file are also not allowed to login from ftp even they are not prompt for password.

By default this file have an entry for root that way root is denied form login even not asked for password remove root from list and add user vinita

After saving change in these files restart the vsftpd service

Now go on client system and login from root this time root will login

Now try to login form user vinita she should not prompt form password also

How to set login banner for ftp server
To set login banner open /etc/vsftpd/vsftpd.conf file and search for this tag

Uncomment this tag and set your banner and save file , and restart the vsftpd service

Go on client system and check banner it will appear before user login


Posts : 2348
Join date : 2010-05-09
Age : 35
Location : UK

Back to top Go down

Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum