ftp服务器搭建-安装、配置及验证

ftp服务器搭建-安装、配置及验证


#安装

sudo apt-get install vsftpd

#配置文件

复制代码
cat > /etc/vsftpd.conf  << "EOF"
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=ftp
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
local_root=/home/test            #需要建立 对应的root dir
EOF

#创建用户

复制代码
echo test  > /etc/vsftpd.chroot_list

#设置密码

复制代码
password test 

#建立主目录

复制代码
mkdir /home/test 
sudo chmod -R 777 /home/test 
touch test						#放一个测试文件 

#本地验证

复制代码
root@localhost:/home/ftp# ftp localhost
Connected to localhost.
220 (vsFTPd 3.0.5)
Name (localhost:root): test 
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
200 EPRT command successful. Consider using EPSV.
150 Here comes the directory listing.
-rw-r--r--    1 0        0              13 Nov 24 15:46 test
226 Directory send OK.
ftp> get test
local: test remote: test
200 EPRT command successful. Consider using EPSV.
150 Opening BINARY mode data connection for test (0 bytes).
226 Transfer complete.

The End.

相关推荐
爱写代码的森5 小时前
鸿蒙三方库 | harmony-utils之ImageUtil图片保存到本地详解
服务器·华为·harmonyos·鸿蒙·huawei
HLC++9 小时前
Linux的进程间通信
android·linux·服务器
华清远见IT开放实验室10 小时前
实验室建设案例 | 石家庄科技信息职业学院嵌入式实验室——从底层硬件到系统应用,一所应用型高校的嵌入式人才培养这样落地
linux·arm开发·stm32·嵌入式硬件·高校·实验室建设
白露与泡影10 小时前
Arthas 实战指南:从方法耗时定位到 JVM 变量热修改
服务器·jvm·c#
神奇霸王龙11 小时前
Claude Code屠榜:MiMo与Grok紧追Codex
服务器·网络·人工智能·gpt·ai·ai编程
Web极客码11 小时前
WordPress SEO优化:提升网站排名的13个关键步骤
服务器·seo·wordpress
groundhappy13 小时前
idalib安装和codex ida-mcp配置
linux·开发语言·python
通信小小昕13 小时前
Ubuntu 26.04 中文输入法安装
linux·运维·ubuntu
张小姐的猫14 小时前
【Linux】网络编程 —— HTTP协议(上)
linux·运维·服务器·网络·http·单例模式·策略模式
国科安芯14 小时前
星间光链路:AS32S601型抗辐射MCU在空间激光通信终端控制中的技术实现
服务器·网络·单片机·嵌入式硬件·物联网·安全·信息与通信