FreeBSD configure FTP service
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 serverWe 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
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Docker process viewing method: 1. Docker CLI command: docker ps; 2. Systemd CLI command: systemctl status docker; 3. Docker Compose CLI command: docker-compose ps; 4. Process Explorer (Windows); 5. /proc directory (Linux).

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.

VS Code is the full name Visual Studio Code, which is a free and open source cross-platform code editor and development environment developed by Microsoft. It supports a wide range of programming languages and provides syntax highlighting, code automatic completion, code snippets and smart prompts to improve development efficiency. Through a rich extension ecosystem, users can add extensions to specific needs and languages, such as debuggers, code formatting tools, and Git integrations. VS Code also includes an intuitive debugger that helps quickly find and resolve bugs in your code.

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

Visual Studio Code (VSCode) is a cross-platform, open source and free code editor developed by Microsoft. It is known for its lightweight, scalability and support for a wide range of programming languages. To install VSCode, please visit the official website to download and run the installer. When using VSCode, you can create new projects, edit code, debug code, navigate projects, expand VSCode, and manage settings. VSCode is available for Windows, macOS, and Linux, supports multiple programming languages and provides various extensions through Marketplace. Its advantages include lightweight, scalability, extensive language support, rich features and version
