admin管理员组

文章数量:1576378


[root@localhost ~]# yum install vsftpd
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 vsftpd.x86_64.0.3.0.2-27.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================
 Package          架构             版本                   源               大小
================================================================================
正在安装:
 vsftpd           x86_64           3.0.2-27.el7           local           172 k

事务概要
================================================================================
安装  1 软件包

总下载量:172 k
安装大小:353 k
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : vsftpd-3.0.2-27.el7.x86_64                                  1/1 
  验证中      : vsftpd-3.0.2-27.el7.x86_64                                  1/1 

已安装:
  vsftpd.x86_64 0:3.0.2-27.el7                                                  

完毕!
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
"/etc/vsftpd/vsftpd.conf" 128L, 5115C written
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# useradd Jack
[root@localhost ~]# passwd Jack
更改用户 Jack 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost ~]# firewall-cmd --permanent --add-port=21/tcp
success
[root@localhost ~]# mkdie /data
-bash: mkdie: 未找到命令
[root@localhost ~]# ls
anaconda-ks.cfg  yum
[root@localhost ~]# cd /
[root@localhost /]# mkdir data
[root@localhost /]# cd data
[root@localhost data]# mkdir ftp_data
[root@localhost data]# ls
ftp_data
[root@localhost data]# cd ftp_data
[root@localhost ftp_data]# touch ftp.test
[root@localhost ftp_data]# echo "123" >1.txt
[root@localhost ftp_data]# ls
1.txt  ftp.test
[root@localhost ftp_data]# cd
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
"/etc/vsftpd/vsftpd.conf" 128L, 5115C
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
Local_root=/data/ftp_data
"/etc/vsftpd/vsftpd.conf" 129L, 5141C written
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# setforce 0
-bash: setforce: 未找到命令
[root@localhost ~]# setenforce 0
[root@localhost ~]# getendorce
-bash: getendorce: 未找到命令
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# systemctl start vsftpd
[root@localhost ~]# systemctl restart firewalld
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
"/etc/vsftpd/vsftpd.conf" 129L, 5141C
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
local_root=/data/ftp_data
"/etc/vsftpd/vsftpd.conf" 129L, 5141C written
[root@localhost ~]# systemctl restart vsftpd
[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
[root@localhost ~]# cd /data/ftp_data
[root@localhost ftp_data]# ls
1.txt  ftp.test
[root@localhost ftp_data]# cd ..
[root@localhost data]# chmod 757 ftp_data
[root@localhost data]# ls -la
总用量 0
drwxr-xr-x.  3 root root  22 1月   3 13:24 .
dr-xr-xr-x. 18 root root 236 1月   3 13:24 ..
drwxr-xrwx.  2 root root  35 1月   3 13:25 ftp_data
[root@localhost data]# ls
ftp_data
[root@localhost data]# cd ftp_data
[root@localhost ftp_data]# ls
1.txt  calendar.txt  ftp.test
[root@localhost ftp_data]# cd
Microsoft Windows [版本 10.0.18363.1256]
(c) 2019 Microsoft Corporation。保留所有权利。



cmd 主机上配置
C:\Users\user>ftp 192.168.146.157
连接到 192.168.146.157。
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
用户(192.168.146.157:(none)): Jack
331 Please specify the password.
密码:
230 Login successful.
ftp> pwd
257 "/data/ftp_data"
ftp> !dir 
 驱动器 C 中的卷是 OS
 卷的序列号是 BEC9-443B

 C:\Users\user 的目录

2021/01/02  20:13    <DIR>          .
2021/01/02  20:13    <DIR>          ..
2020/08/31  08:48    <DIR>          .idlerc
2020/12/11  19:33    <DIR>          .ipynb_checkpoints
2020/12/07  11:19    <DIR>          .ipython
2020/12/07  11:21    <DIR>          .jupyter
2020/11/22  22:00    <DIR>          .matplotlib
2020/08/13  20:22    <DIR>          ansel
2021/01/02  14:43             1,954 calendar.txt
2020/12/19  17:08    <DIR>          code4
2020/12/16  17:01    <DIR>          code5
2020/12/10  18:42    <DIR>          Contacts
2020/12/11  16:03    <DIR>          Desktop
2021/01/02  09:28    <DIR>          Downloads
2020/12/10  18:42    <DIR>          Favorites
2021/01/02  20:13                 0 ftp_test
2020/12/10  18:42    <DIR>          Links
2020/07/20  08:28    <DIR>          OneDrive
2020/12/10  18:42    <DIR>          Pictures
2020/10/26  09:45    <DIR>          PycharmProjects
2020/12/10  18:42    <DIR>          Saved Games
2020/12/10  18:42    <DIR>          Searches
2020/07/20  07:43    <DIR>          source
2020/12/21  23:59    <DIR>          Videos
2020/08/13  20:20               384 此电脑 - 快捷方式.lnk

 C:\Users\user 的目录

               3 个文件          2,338 字节
              22 个目录 20,688,572,416 可用字节
ftp> pu calendar.txt 
【此处下载一个 C:\Users\user 的目录的文件或者自己创在C:\Users\user 的目录的txt文件】
200 PORT command successful. Consider using PASV.
553 Could not create file.
ftp> bye
221 Goodbye.

C:\Users\user>ftp 192.168.146.157
连接到 192.168.146.157。
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
用户(192.168.146.157:(none)): Jack
331 Please specify the password.
密码:
230 Login successful.
ftp> pwd
257 "/data/ftp_data"
ftp> pu calendar.txt
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 Transfer complete.
ftp: 发送 1954 字节,用时 0.00秒 651.33千字节/秒。
ftp> mget 1.txt
200 Switching to ASCII mode.
mget 1.txt? y
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for 1.txt (4 bytes).
226 Transfer complete.
ftp: 收到 4 字节,用时 0.00秒 4000.00千字节/秒。
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
1.txt
calendar.txt
ftp.test
226 Directory send OK.
ftp: 收到 34 字节,用时 0.00秒 34.00千字节/秒。
ftp> bye



[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO
#
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
"/etc/vsftpd/vsftpd.conf" 129L, 5141C
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=NO
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
local_root=/data/ftp_data
chroot_local_user=YES
allow_writeable_chroot=YES
"/etc/vsftpd/vsftpd.conf" 131L, 5190C written
[root@localhost ~]# systemctl restart vsftpd
[root@localhost ~]# 




C:\Users\user>ftp 192.168.146.157
连接到 192.168.146.157。
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
用户(192.168.146.157:(none)): Jack
331 Please specify the password.
密码:
230 Login successful.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
1.txt
calendar.txt
ftp.test
226 Directory send OK.
ftp: 收到 34 字节,用时 0.00秒 17.00千字节/秒。
ftp> pwd
257 "/"
ftp> cd ~
250 Directory successfully changed.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
1.txt
calendar.txt
ftp.test
226 Directory send OK.
ftp: 收到 34 字节,用时 0.00秒 8.50千字节/秒。
ftp>

本文标签: 服务器配置FTP