Home System Tutorial LINUX FreeBSD configure FTP service

FreeBSD configure FTP service

Feb 01, 2024 pm 05:12 PM
linux linux tutorial Red Hat linux system linux command linux certification red hat linux linux video

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1655
14
PHP Tutorial
1252
29
C# Tutorial
1226
24
Linux Architecture: Unveiling the 5 Basic Components Linux Architecture: Unveiling the 5 Basic Components Apr 20, 2025 am 12:04 AM

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

vscode terminal usage tutorial vscode terminal usage tutorial Apr 15, 2025 pm 10:09 PM

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

How to check the warehouse address of git How to check the warehouse address of git Apr 17, 2025 pm 01:54 PM

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

How to run java code in notepad How to run java code in notepad Apr 16, 2025 pm 07:39 PM

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.

What is the main purpose of Linux? What is the main purpose of Linux? Apr 16, 2025 am 12:19 AM

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.

vscode Previous Next Shortcut Key vscode Previous Next Shortcut Key Apr 15, 2025 pm 10:51 PM

VS Code One-step/Next step shortcut key usage: One-step (backward): Windows/Linux: Ctrl ←; macOS: Cmd ←Next step (forward): Windows/Linux: Ctrl →; macOS: Cmd →

vscode terminal command cannot be used vscode terminal command cannot be used Apr 15, 2025 pm 10:03 PM

Causes and solutions for the VS Code terminal commands not available: The necessary tools are not installed (Windows: WSL; macOS: Xcode command line tools) Path configuration is wrong (add executable files to PATH environment variables) Permission issues (run VS Code as administrator) Firewall or proxy restrictions (check settings, unrestrictions) Terminal settings are incorrect (enable use of external terminals) VS Code installation is corrupt (reinstall or update) Terminal configuration is incompatible (try different terminal types or commands) Specific environment variables are missing (set necessary environment variables)

How to run sublime after writing the code How to run sublime after writing the code Apr 16, 2025 am 08:51 AM

There are six ways to run code in Sublime: through hotkeys, menus, build systems, command lines, set default build systems, and custom build commands, and run individual files/projects by right-clicking on projects/files. The build system availability depends on the installation of Sublime Text.

See all articles