twbsd.org
 
  Select Language: Home  SmbFTPD Forum 

SmbFTPD

Introduction

Document

Download


SmbFTPD

SmbFTPD Handbook

Priv
Introduction
  Next
smbftpd.conf

Chapter 2 Installation

Table of Contents

2.1 Requirements

2.2 Compile and installation

2.2 Running SmbFTPD

2.1 Requirements

In order to compile and install SmbFTPD, you need:

  • Perl (Practical Extraction and Report Language), which is required to run the configure.
  • Berkeley Yacc (which is known as yacc or byacc), an LALR parser generator.
  • The GNU Compiler Collection (gcc).
  • The GNU binary utilities (binutils).
  • To use SSL/TLS feature, you will need OpenSSL 0.9.6 or higher, OpenSSL 0.9.7 is recommended;

2.2 Compile and Installation

After download the SmbFTPD, please un-tar and change directory in it. Then you may compile by the following commands:

# ./configure
# make

The configure command will detect your system environment and decide the compile options and features to install, such as IPv6 support, TCP Wrapper, or PAM, etc.

Other available options  for configure:

# ./configure --help
Optional Features:
   --with-mysql[=DIR]    Users database is a MySQL database (default=no)
   --with-pgsql[=DIR]    Users database is a PostgreSQL database (default=no)
   --with-ssl[=DIR]      Enable SSL/TLS support (default=no)
   --with-iconv=[DIR]    Enable codepage to unicode conversion for UTF-8 FTP (default=no)
   --prefix=PREFIX       Install architecture-independent files in PREFIX [/usr/local]

If you would like to use MySQL virtual user function, please add the option --with-mysql. To use SSL/TLS, add --with-ssl.

After compile, if you have SSL/TLS support, you will need SSL certificate and private key. If you have installed Apache+SSL, you can use the its certificate, too. To generate certificate, please use the following commnad before install:

# make cert

We will generate a self signing certificate. Now you can install the SmbFTPD by the following commnad:

# make install

If you would like to cross compile, just set the path of CC in the environment:

# env CC=/usr/local/powerpc-linux/bin/powerpc-linux-gcc \
    LD=/usr/local/powerpc-linux/bin/powerpc-linux-ld \
    RANLIB=/usr/local/powerpc-linux/bin/powerpc-linux-ranlib \
    ./configure --with-ssl --with-iconv
# make
# make cert
# make install

After make install, we will install the smbftpd into /usr/local/sbin and install the smbftpd.conf and smbftpd_share.conf into /usr/local/etc/smbftpd/. If you are installing the SmbFTPD in Linux and the /etc/pam.d/ftpd does not exist, we will also install a ftpd PAM file (Pluggable Authentication Modules). Some OS, such as Fedora does not have PAM for ftpd. But smbftpd might need it.

If you would like to install smbftpd into other directory rather then /usr/local, you can add option --prefix=/path/to/your/dir when running configure.

2.3 Running SmbFTPD

Before starting the SmbFTPD, you should edit /usr/local/etc/smbftpd/smbftpd.conf. If not, you will use the default configuration which is usually ok. We will descript more about the configuration file in the next chapter.

There are two ways to use the FTP daemon: as an inetd-based service or in a daemon mode. The most common manner is to run the ftpd as the inetd-based service. In this case the internet "super-server" listens for connections, does access control and starts the server to handle the request. In the daemon mode, the ftpd itself accepts connections on the FTP port and forks children processes to handle them. This mode has the lower overhead and thus is useful on busy servers to reduce load.

There are two popular implementations of the "super-server": inetd and xinetd. The capabilities of inetd may vary in different operating systems: modern distributions of BSD systems usually use an enhanced version of this software as a default "super-server", but in other systems, include most Linux distributions, a simpler one is available.

The xinetd is a powerful replacement for inetd and it's used as the default internet "super-server" in a number of modern Linux distributions, but it's also available for some other operating systems, include most popular BSD ones.

In case of inetd you need to edit the /etc/inetd.conf file and to add something like this into it:

ftp     stream  tcp     nowait  root    /usr/local/sbin/smbftpd smbftpd 

The xinetd configuration may be stored in the /etc/xinetd.conf file or in separate files (with the same syntax as xinetd.conf) with arbitrary names in the /etc/xinetd.d/ directory. If the xinetd.d/ directory exists, then xinetd.conf contains some defaults and xinetd.d/ contains configurations of individual services.

Next configuration may be recommended as a template:

# file: /etc/xinetd.d/smbftpd
# default: off
# description: SmbFTPD supports TLS/SSL for both control and data
# connections, but also fully compatible with standard FTP protocol.
service ftp
{
	disable     = no
	flags       = REUSE
	socket_type = stream
	protocol    = tcp
	wait        = no
	user        = root
	server      = /usr/local/sbin/smbftpd
}

In this example, the service is enable by default, so you need to change the "disable" flag from "no" to "yes" to disable the secure FTP server. After changing of the configuration, you need to force inetd or xinetd to re-read it. See also the documentation of the corresponding software for more information, in particular the inetd(8) and/or xinetd(8) man pages.

If you would like to run smbftpd as a standalone daemon just use the following command:

# /usr/local/sbin/smbftpd -D

For FreeBSD users, if you would like to run smbftpd at boot time, please edit the /etc/rc.conf and add the following line:

smbftpd_enable="Yes"
smbftpd_flags="-D"

Than you can use the following command to start SmbFTPD:

# /usr/local/etc/rc.d/smbftpd.sh start

To stop:

# /usr/local/etc/rc.d/smbftpd.sh stop

Here are available options you can use when starting smbftpd:

Option Description
-4 Accept IPv4 connection only.
-6 Accept IPv6 connection only.
-D With this option set, ftpd will detach and become a daemon, accepting connections on the FTP port and forking children processes to handle them. This is lower overhead than starting ftpd from inetd(8) and is thus useful on busy servers to reduce load.
-s /path/to/smbftpd.conf Specify alternative smbftpd.conf. The default path of smbftpd.conf is /usr/local/etc/smbftpd/smbftpd.conf. You may change the path by this option.

 


Priv
Introduction

Index
This document can be downloaded from http://www.twbsd.org.

Next
smbftpd.conf

Copyright © 2002-2024 Alex Wang from www.twbsd.org. All rights reserved.