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.

相关推荐
绿箭柠檬茶1 小时前
Ubuntu 使用 Samba 共享文件夹
linux·运维·ubuntu
工藤新一¹2 小时前
Linux —— 虚拟进程地址空间
linux·运维·服务器·c/c++·虚拟进程地址空间
Aspiresky2 小时前
浅析Linux内核scatter-gather list实现
linux·dma·scatter/gather
奔跑吧 android3 小时前
【linux kernel 常用数据结构和设计模式】【数据结构 3】【模拟input子系统input_dev和input_handler之间的多对多关系】
linux·数据结构·input·kernel·input_dev·input_handler·input_handle
再难也得平3 小时前
Linux初级篇
linux·运维·服务器
小猫挖掘机(绝版)4 小时前
通过tailscale实现一台电脑上vscode通过ssh连接另一台电脑上的VMware Linux 虚拟机
linux·windows·vscode·ubuntu·ssh
attitude.x4 小时前
Swift 协议扩展与泛型:构建灵活、可维护的代码的艺术
运维·服务器·网络
专注VB编程开发20年4 小时前
rust语言-对象多级访问
服务器·前端·rust
ajassi20004 小时前
开源 C++ QT Widget 开发(十三)IPC通讯--本地套接字 (Local Socket)
linux·c++·qt·开源
方先森有点懒5 小时前
CentOS 7.2 虚机 ssh 登录报错在重启后无法进入系统
linux·运维·centos·ssh