search
HomeSystem TutorialLINUXFreeBSD configure FTP service

FreeBSD configure FTP service

Feb 01, 2024 pm 05:12 PM
linuxlinux tutorialRed Hatlinux systemlinux commandlinux certificationred hat linuxlinux 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
This article is reproduced at:Linux就该这么学. If there is any infringement, please contact admin@php.cn delete
What are the differences in virtualization support between Linux and Windows?What are the differences in virtualization support between Linux and Windows?Apr 22, 2025 pm 06:09 PM

The main differences between Linux and Windows in virtualization support are: 1) Linux provides KVM and Xen, with outstanding performance and flexibility, suitable for high customization environments; 2) Windows supports virtualization through Hyper-V, with a friendly interface, and is closely integrated with the Microsoft ecosystem, suitable for enterprises that rely on Microsoft software.

What are the main tasks of a Linux system administrator?What are the main tasks of a Linux system administrator?Apr 19, 2025 am 12:23 AM

The main tasks of Linux system administrators include system monitoring and performance tuning, user management, software package management, security management and backup, troubleshooting and resolution, performance optimization and best practices. 1. Use top, htop and other tools to monitor system performance and tune it. 2. Manage user accounts and permissions through useradd commands and other commands. 3. Use apt and yum to manage software packages to ensure system updates and security. 4. Configure a firewall, monitor logs, and perform data backup to ensure system security. 5. Troubleshoot and resolve through log analysis and tool use. 6. Optimize kernel parameters and application configuration, and follow best practices to improve system performance and stability.

Is it hard to learn Linux?Is it hard to learn Linux?Apr 18, 2025 am 12:23 AM

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

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.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

See all articles

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

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor