Setup FTP Server on Ubuntu Linux Server

  • Open a terminal window.
    A File Transfer Protocol (FTP) server allows users to upload and download files to a server using the FTP protocol. FTP is useful because it is cross platform and faster than HTTP for large files. It also allows a far wider range of transfer commands, including batch transfers and transfers optimized for either ASCII or binary files. Ubuntu is a very popular distribution of the Linux operating system. Ubuntu is available as either a desktop or server distribution. The steps below provide a better understanding of the two programs.
  • Install vsftpd. Vsftpd is the daemon, or server, that users will connect to. To install vsftpd, type “sudo apt-get install vsftpd.”

  • vsftpd – FTP Server Configuration.
    You can edit the vsftpd configuration file, /etc/vsftpd.conf, to change the default settings. By default only anonymous FTP is allowed. If you wish
    to disable this option, you should change the following line:
    anonymous_enable=YES
    to
    anonymous_enable=NOBy default, local system users are not allowed to login to FTP server. To change this setting, you should uncomment the following line:

    #local_enable=YES

    By default, users are allowed to download files from FTP server. They are not allowed to upload files to FTP server.
    To change this setting, you should uncomment the following line:

    #write_enable=YES

    Similarly, by default, the anonymous users are not allowed to upload files to FTP server. To change this setting,
    you should uncomment the following line:

    #anon_upload_enable=YES

    The configuration file consists of many configuration parameters. The information about each parameter is available
    in the configuration file. Alternatively, you can refer to the man page, man 5 vsftpd.conf for details of each parameter.

    Once you configure vsftpd you can start the daemon. You can run following command to run the vsftpd daemon:

  • Create a user group and shared directory. In this case, use /home/ftp-users and a user group name of ftp-users for the remote users
    [iyngaran@iyngaran-laptop]# groupadd ftp-users
    [iyngaran@iyngaran-laptop]# mkdir /home/ftp-docs
  • Make the directory accessible to the ftp-users group.
    [iyngaran@iyngaran-laptop]# chmod 750 /home/ftp-docs
    [iyngaran@iyngaran-laptop]# chown root:ftp-users /home/ftp-docs
  • Add users, and make their default directory /home/ftp-docs .
    [iyngaran@iyngaran-laptop]# useradd -g ftp-users -d /home/ftp-docs user1
    [iyngaran@iyngaran-laptop]# useradd -g ftp-users -d /home/ftp-docs user2
    [iyngaran@iyngaran-laptop]# passwd user1
    [iyngaran@iyngaran-laptop]# passwd user2
  • Copy files to be downloaded by your users into the /home/ftp-docs directory.
  • Change the permissions of the files in the /home/ftp-docs directory for read only access by the group.
    [iyngaran@iyngaran-laptop]# chown root:ftp-users /home/ftp-docs/*
    [iyngaran@iyngaran-laptop]# chmod 740 /home/ftp-docs/*
  • Now you must restart the daemon. You can run following command to run the vsftpd daemon:
    Users should now be able to log in via FTP to the server using their new usernames and passwords. If you absolutely don’t want any FTP users to be able to write to any directory, then you should set the write_enable line in your vsftpd.conf file to no:
    Here is a simple test procedure you can use to make sure everything is working correctly.
  • Check for the presence of a test file on the ftp client server.
    [iyngaran@iyngaran-laptop]# ll
    total 1
    -rw-r–r– 1 root root 0 Jan 4 09:08 testfile
    [iyngaran@iyngaran-laptop]#
  • Connect to bigboy via FTP.
    [iyngaran@iyngaran-laptop]# ftp 192.168.1.10
    Connected to 192.168.1.100 (192.168.1.100)
    220 ready, dude (vsFTPd 1.1.0: beat me, break me)
    Name (192.168.1.100:root): user1
    331 Please specify the password.
    Password:
    230 Login successful. Have fun.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp>

Be the first to comment

Leave a Reply

Your email address will not be published.


*


*