OpenBSD built-in ftpd program build ftp Server

Source: Internet
Author: User
Article Title: OpenBSD build an ftp server with ftpd program. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories written above

This document is written in OpenBSD 3.8's official FAQ document and ftpd man document. For more information, see these two documents.
· FAQ: Setting up Anonymous FTP Services
· Manual Page: ftpd
All the operations passed the test on OpenBSD 3.8 Release.
Note: This article can be reproduced at will, but please keep the author's information. Thank you.

Three ftpd startup Methods

If the ftpd program of OpenBSD does not have a configuration file, you need to configure the running parameters. All parameters
The meaning can be detailed in the ftpd man document:
$ Man ftpd
There are three methods to start the ftpd program:
· Inetd Method
· 'Rc 'Mode
· Execute the ftpd command directly under the command line

1. inetd Method

There is such a line in The 'etc/inetd. conf' file:

Ftp stream tcp nowait root/usr/libexec/ftpd-US
Here, two parameters '-us' are passed for 'ftpd '. Of course, you can also combine the parameters you want.
(The meanings of some common parameters are provided below ). In inetd mode, ftpd is managed by inetd process
So you need to start the inetd service to start ftpd. In the default OpenBSD settings, inetd is
Set to start with the system. View the value of the 'inetd' variable in '/etc/rc. conf:
Inetd = YES

2. 'rc 'Mode

The 'rc 'method means to change the value by modifying the'/etc/rc. conf' or '/etc/rc. conf. local' file.
The value of the volume. Add the 'entry 'For the startup of the service so that the service can be started with the system. Use the 'rc 'method to start
To change the fttpd, you only need to set the 'ftpd _ flags 'variable in'/etc/rc. conf' to a self-assembled parameter.
You can. This method requires that the service be started with the system after the system is restarted (the parameters here are temporarily used
Parameters in the same way as 'inetd ):

Ftpd_flags = "-US"

3. Execute the ftpd command directly on the command line.

The advantage of this method is that you can start the ftpd service without restarting the system:

#/Usr/libexec/ftpd-4DllUS stop ftpd

1. '/etc/rc. conf'

If you do not need to enable ftpd with the system, set the value of the 'ftpd _ flags 'variable in the'/etc/rc. conf' file.
Set to "NO "":

Ftpd_flags = "NO"

2. # kill PID
If you need to end the ftpd process now, use \ kill PID "to implement it:

# Kill $ (cat/var/run/ftpd. pid) Common ftpd Parameters

The following are some common ftpd parameters (not all are listed here. More Parameters
For more information, see the Manual Page of OpenBSD.

-4 if the \-D "parameter is specified, the Force ftpd only uses the IPv4 address.
-6 and \-4 are interpreted similarly. If the \-D parameter is specified, the Force ftpd only uses the IPv6 address.
-A only allows anonymous logon (unless the \-n "option is specified ).
·-D if this parameter is specified, ftpd runs as daemon, listens to the ftpd port, and fork sub-processes process the connection. On a busy server, this reduces system load and uses less system resources than starting ftpd using inetd.
·-D use log ftp to write Debug information to syslog.
·-L each successful or failed ftp session will be recorded by the log ftp tool through syslog. If this option is specified twice (-ll ), all get/put/append/delete/make, directory/remove, dire operations, and operated files will be recorded in the log.
·-U each concurrent ftp session is recorded in the log file/var/run/utmp. The record format is the same as the output of the who (1) command.
·-N prohibit Anonymous logon. It is allowed by default.
· If this parameter is set for-S, ftpd records the download status of all anonymous users in the file/var/log/ftpd (if the file exists ).
·-T maxtimeout connection timeout time limit. The default value is 2 hours.
·-U mask forcibly sets umask as the specified mask. Instead of using the settings in/etc/login. conf (usually set to 022 in/etc/login. conf), chmod is not allowed.

Common Parameter Combinations

After reading the meanings of the above several common options, you should be able to combine the appropriate options to meet your functional needs.

1. Only the system account can be used to log on to FTP
Because anonymous users need to log on to an account named "ftp" in the system (

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.