tonywhitmore.co.uk  

      blog : gallery : wiki : articles : projects : shell scripts : wallpaper : cv : links :
 Project Homepage

FTP Server (bftpd)

Preparation

  1. Download the bftpd source code from bftpd.sourceforge.net.
    • Visit bftpd.sourceforge.net and click on the "Downloads" link.
    • Click on the link for the source code tarball of the latest version of bftpd.
      • At the time of writing the latest version of bftpd was version 1.0.22, so the file downloaded was bftpd-1.0.22.tar.gz.
    • You will be asked to where you wish to save the file. Chose a safe place and make a note of it.
    • The download is about 71kb and will take only a few seconds over a modem connection, and a lot less over a broadband connection.
    • If you are using a download accelerator program, it will save the file to your default download directory.
  2. Burn the file bftpd-1.0.22.tar.gz to a CD. This page assumes that the subdirectory /apps is used for the .tar.gz file. The CD-ROM can be a multi-session disk.
    • Use your CD burning software to create an ISO9660 disc image with the file bftpd-1.0.22.tar.gz in the /apps directory.
    • Burn the CD and verify the data stored on it.

Back to simple version

Booting

  1. Boot your Core Linux PC.
  2. Login as root. You will need to enter the password at the prompt.
    • Wait for the following text to appear:
      localhost login:
    • Type root and press Enter.
    • The screen will display this message:
      Password:
    • Enter the password for root that you set earlier.
    • You will be shown a prompt that looks like this:
      [~]#

Back to simple version

Extract the source

  1. Place the CD-R in the CD-ROM drive. Mount the CD-ROM drive under /mnt/cdrom.
    • At the prompt enter:
      mount /dev/hdb /mnt/cdrom
    • You will see the following line appear:
      mount: block device /dev/hdb is write-protected, mounting read-only
  2. Change to the /apps directory on the CD-R.
    • At the prompt enter:
      cd /mnt/cdrom/apps
    • The prompt will change to:
      [/mnt/cdrom/apps]#
  3. Copy the bftpd-1.0.22.tar.gz file to the directory /usr/src.
    • At the prompt enter:
      cp bftpd-1.0.22.tar.gz /usr/src
    • The system will not display a message if everything is OK.
  4. Change to the /usr/src directory and extract the source from the .tar.gz file.
    • At the prompt enter:
      cd /usr/src
    • The prompt will change to:
      [/usr/src]#
    • At the prompt enter:
      tar -zxvf bftpd-1.0.22.tar.gz
    • A long stream of unzipping files and directories should scroll up the screen for a few seconds.

Back to simple version

Configure and compile

  1. Change to the /usr/src/bftpd-1.0.22 directory.
    • At the prompt enter:
      cd bftpd-1.0.22
    • The prompt will change to:
      [/usr/src/bftpd-1.0.22]#
  2. Run the ./configure script.
    • At the prompt enter:
      ./configure
    • A stream of processes should scroll up the screen for about twenty seconds.
    • The script finishes with the line:
      creating config.h
  3. Run the make program.
    • At the prompt enter:
      make
    • A stream of processes should scroll up the screen for about twenty seconds.
    • The program finishes with the line:
      gcc bftpdutmp.o commands.o commands_admin.o dirlist.o login.o logging.o main.o mystring.o options.o -lcrypt -o bftpd
  4. Run the make program with the argument install.
    • At the prompt enter:
      make install
    • A stream of processes should scroll up the screen for a few seconds.
    • The program finishes with the line:
      chmod 644 /var/log/bftpd.log

Back to simple version

Setting up bftpd

  1. Create the file/var/run/bftpd/bftpdutmp.
    • At the prompt enter:
      mkdir /var/run/bftpd
    • The system will not display a message if everything is OK.
    • At the prompt enter:
      touch /var/run/bftpd/bftpdutmp
    • The system will not display a message if everything is OK.
  2. Configure a user for FTP access. By default, the user ftp is allowed anonymous logon. No password needs to be set. This prevents the user from logging on at the terminal. Other users require a valid username and password combination for access to the system.
    • Add the user ftp.
      • At the prompt enter:
        useradd ftp
      • The system will not display a message if everything is OK.
    • Set a password for the FTP user.
      • At the prompt enter:
        passwd ftp
      • The screen will change to show:
        Changing password for ftp
        Enter the new password (minimum of 5, maximum of 8 characters)
        Please use a combination of upper and lower case letters and numbers.
        New password:
      • Enter the password. The screen will change to show:
        Re-enter new password:
      • Re-enter the password. The screen will change to show:
        Password changed.
  3. Create the home directory for the FTP user.
    • At the system prompt enter:
      mkdir /home/ftp
    • The system will not display a message if everything is OK.

Back to simple version

Starting bftpd

  1. Start the bftpd server using bftpd -d.
    • At the prompt enter:
      /usr/sbin/bftpd -d
    • The system will not display a message if everything is OK.
  2. Using your other computer, see if you can access the FTP server.
    • Launch your ftp client.
    • Open a connection to the IP address 192.168.0.10. How you do this will vary from client to client.
    • When prompted, enter the username and password of the new FTP user. You should then be given access to the home directory of your FTP user.

Back to simple version

Stopping bftpd

  1. Stop the bftpd server using kill.
    • At the prompt enter:
      ps -A
    • The screen will show a list of the processes currently running. Look for the line containing bftpd and note the PID number.
    • At the system prompt enter:
      kill PID
      where PID is the PID value obtained previously.
    • The system will not display a message if everything is OK.

Back to simple version

Automating bftpd

  1. Append the following line to the /etc/rc.d/rc.mu script:
    bftpd -d
    You can also add comments and echoes for your own information.
    • At the prompt enter:
      nano /etc/rc.d/rc.mu
    • The screen will show the contents of /etc/rc.d/rc.mu with information about the file at the top and bottom of the screen.
    • Add the following text to the end of the file:
      # Start bftpd
      /usr/sbin/bftpd -d
      echo bftpd started
    • Save the file and exit the text editor.
      • Press Ctrl+x on the keyboard.
      • The contents of the white line at the bottom of the screen will change to read:
        Save modified buffer (ANSWERING "No" WILL DESTROY CHANGES) ?
      • Type y.
      • The contents of the white line at the bottom of the screen will change to read:
        File Name to write: /etc/rc.d/rc.mu
      • Press Enter.
      • You will be returned to the system prompt.
  2. Reboot the system and check that bftpd is running.
    • At the system prompt enter:
      shutdown -r now
    • Wait for the system to reboot.
    • As the system reboots, watch for any error messages.
    • Once the system has rebooted, try to access the FTP server using the FTP client on your other PC.

Back to simple version

Creative Commons License
The text of this page is licensed under a Creative Commons License.


Valid CSS!     Valid HTML 4.0!     Valid RSS
Original design © For oswd.org by SquireCD