vim /etc/vsftpd/vsftpd.conf
1 anonymous_enable=NO
2 local_enable=YES
3 guest_enable=YES
4 guest_username=virtual
5 allow_writeable_chroot=YES
6 write_enable=YES
7 local_umask=022
8 dirmessage_enable=YES
9 xferlog_enable=YES
10 connect_from_port_20=YES
11 xferlog_std_format=YES
12 listen=NO
13 listen_ipv6=YES
14 pam_service_name=vsftpd.vu
15 userlist_enable=YES
16 tcp_wrappers=YES
mkdir /etc/vsftpd/vusers_dir/
cd /etc/vsftpd/vusers_dir/
touch lisi
vim zhangsan
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
vim /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
guest_enable=YES
guest_username=virtual
allow_writeable_chroot=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd.vu
userlist_enable=YES
tcp_wrappers=YES
user_config_dir=/etc/vsftpd/vusers_dir
systemctl restart vsftpd
systemctl enable vsftpd
ln -s '/usr/lib/systemd/system/vsftpd.service' '/etc/systemd/system/multi-
user.target.wants/vsftpd.service
getsebool -a | grep ftp
ftp_home_dir –> off
ftpd_anon_write –> off
ftpd_connect_all_unreserved –> off
ftpd_connect_db –> off
ftpd_full_access –> off
ftpd_use_cifs –> off
ftpd_use_fusefs –> off
ftpd_use_nfs –> off
ftpd_use_passive_mode –> off
httpd_can_connect_ftp –> off
httpd_enable_ftp_server –> off
sftpd_anon_write –> off
sftpd_enable_homedirs –> off
sftpd_full_access –> off
sftpd_write_ssh_home –> off
tftp_anon_write –> off
tftp_home_dir –> off
setsebool -P ftpd_full_access=on
ftp 192.168.10.10
Connected to 192.168.10.10 (192.168.10.10).
220 (vsFTPd 3.0.2)
Name (192.168.10.10:root): lisi
331 Please specify the password.
Password:此处输入虚拟用户的密码
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> mkdir files
550 Permission denied.
ftp> exit
221 Goodbye.
ftp 192.168.10.10
Connected to 192.168.10.10 (192.168.10.10).
220 (vsFTPd 3.0.2)
Name (192.168.10.10:root): zhangsan
331 Please specify the password.
Password:此处输入虚拟用户的密码
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> mkdir files
257 "/files" created
ftp> rename files database
350 Ready for RNTO.
250 Rename successful.
ftp> rmdir database
250 Remove directory operation successful.
ftp> exit
221 Goodbye.
yum install tftp-server tftp
Loaded plugins: langpacks, product-id, subscription-manager
………………省略部分输出信息………………
Installing:
tftp x86_64 5.2-11.el7 rhel 35 k
tftp-server x86_64 5.2-11.el7 rhel 44 k
Installing for dependencies:
xinetd x86_64 2:2.3.15-12.el7 rhel 128 k
Transaction Summary
===============================================================================
Install 2 Packages (+1 Dependent package)
Total download size: 207 k
Installed size: 373 k
Is this ok [y/d/N]: y
Downloading packages:
………………省略部分输出信息………………
Installed:
tftp.x86_64 0:5.2-11.el7 tftp-server.x86_64 0:5.2-11.el7
Dependency Installed:
xinetd.x86_64 2:2.3.15-12.el7
Complete!
vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
systemctl restart xinetd
systemctl enable xinetd
firewall-cmd --permanent --add-port=69/udp
success
firewall-cmd --reload
success
tftp命令参数
命令
作用
?
帮助信息
put
上传文件
get
下载文件
verbose
显示详细的处理信息
status
显示当前的状态信息
binary
使用二进制进行传输
ascii
使用ASCII码进行传输
timeout
设置重传的超时时间
quit
退出
复制成功
1 2 3 4 5 6 7 8 91011
/var/lib/tftpboot/readme.txt
tftp 192.168.10.10
tftp> get readme.txt
tftp> quit
ls
anaconda-ks.cfg Documents initial-setup-ks.cfg Pictures readme.txt Videos
Desktop Downloads Music Public Templates
cat readme.txt
i love linux