Home > System Tutorial > LINUX > body text

FreeBSD configure FTP service

PHPz
Release: 2024-02-01 17:12:19
forward
1087 people have browsed it

FreeBSD 配置FTP服务

FreeBSD has a built-in FTP server function. If you want to use the built-in ftpd, you don’t need to install it, just set it up.

Start FTP server

We have two ways to start ftpd, one is to use standalone daemon, the other is to use inetd. inetd is a powerful "super server" in UNIX systems. We can use it to manage many system services, such as telnet, ssh, ftp, etc. Most system services are started using inetd. The advantage of using it is that it can uniformly manage various services and set service rules through it, such as whether to block certain IP sources. However, the disadvantage of using inetd is that every time there is a connection request, the inetd daemon must execute the corresponding instructions according to the type of connection, so the speed is relatively slow.

Another way to start FTP is to use the standalone daemon, that is, to directly execute the FTP daemon. When it receives a new connection, it will fork() it to process it. This method establishes the connection faster and is more suitable. Dedicated FTP server.

Use inetd

Let’s first introduce how to use inetd to start the FTP server. First, please edit /etc/inetd.conf and remove the # at the beginning of the ftp setting:
ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l<br> ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l
Next, we must rerun inetd using the following command:
# kill -1 `cat /var/run/inetd.pid`
(This command is based on already running inetd) If the ftp server is not running, enter in Alt F2: inetd Now you can start using FreeBSD's FTP service.
!/bin/sh<br> ftpd_program="/usr/libexec/ftpd"<br> ftpd_flags="-D -l"<br> case $1 in<br> start)<br> echo "Starting FTPD"<br> $ftpd_program $ftpd_flags<br> ;;<br> stop)<br> echo "Stopping FTPD"<br> killall ftpd<br> ;;<br> restart)<br> $0 stop<br> sleep 1<br> $0 start<br> ;;<br> esac
After editing, we must make the file executable:
# chmod 755 /usr/local/etc/rc.d/ftpd<br> Next, you can start FTPD using the following command: <br> # /usr/local/etc/rc.d/ftpd start or <br> # service ftpd start
If you want to stop the FTPD service, use the following command:
# /usr/local/etc/rc.d/ftpd stop

Edit Welcome Message

When we connect to an FTP site, we can see two welcome messages, one is the message before logging in, and the other is the message after logging in. Take the following message as an example:
ftp localhost Trying ::1...<br> Connected to localhost.alexwang.com.<br> 220- Welcome to My FTP Server.<br> 220-<br> 220- This is a welcome message<br> 220-<br> 220- Nice to see you.<br> 220 vmware.alexwang.com FTP server (Version 6.00LS) ready.<br> Name (localhost:alex):<br> 331 Password required for alex.<br> Password:<br> 230- This is the message of the day.<br> 230-<br> 230- It will be shown after user login.<br> 230 User alex logged in.<br> Remote system type is UNIX.<br> Using binary mode to transfer files.<br> ftp>
The message starting with 220- is the message before logging in. We call it the welcome message. The message starting with 230- is the message after login. We call it the Message of the day. We can set both of these messages ourselves. If you want to set the pre-login message, please add a new file /etc/ftpwelcome and write your message into the file. The following is the message content in the above example:
Welcome to My FTP Server.<br> This is a welcome message<br> Nice to see you.
You don't need to write 220- and other data, the FTP server will automatically add this code for you. The logged-in information is stored in /etc/ftpmotd. You can edit this file to set it.

The above is the detailed content of FreeBSD configure FTP service. For more information, please follow other related articles on the PHP Chinese website!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!