LINUX67 FTP 3客户服务系统;FTP 上传、下载测试调试

FTP

FTP客户服务系统

创建kefu2用户

bash 复制代码
[root@code ~]# tail -2 /etc/passwd
jerry:x:1021:1229::/home/jerry:/bin/bash
kefu:x:1022:1022::/home/kefu:/bin/bash
[root@code ~]# useradd kefu2
[root@code ~]# tail -3 /etc/passwd
jerry:x:1021:1229::/home/jerry:/bin/bash
kefu:x:1022:1022::/home/kefu:/bin/bash
kefu2:x:1023:1023::/home/kefu2:/bin/bash
[root@code ~]# echo 123|passwd --stdin kefu2
更改用户 kefu2 的密码 。
passwd:所有的身份验证令牌已经成功更新。
您在 /var/spool/mail/root 中有新邮件

文档保存在/data/kefu2

bash 复制代码
[root@code ~]# mkdir -p /data/kefu2
[root@code ~]# ls
2-1.java  alll1            app       axel-2.4.tar.gz  cc.conf  initial-setup-ks.cfg       ok   readme7
2.java    anaconda-ks.cfg  axel-2.4  bb.conf          code     inotify-tools-3.13.tar.gz  okl  readme.txt
[root@code ~]# cd /data/kefu2
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]#

不允许匿名访问

bash 复制代码
[root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
local_root=/date/kefu
chroot_local_user=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
userlist_enable=YES
tcp_wrappers=YES
[root@code kefu2]#

anonymous_enable=NO

systemctl restart vsftpd

指定账号访问的目录

bash 复制代码
[root@code kefu2]# vim /etc/vsftpd/vsftpd.conf
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
local_root=/date/kefu2
chroot_local_user=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
userlist_enable=YES
tcp_wrappers=YES
[root@code kefu2]# systemctl restart ftpd
Failed to restart ftpd.service: Unit not found.
[root@code kefu2]# systemctl restart vsftpd
您在 /var/spool/mail/root 中有邮件

限定kefu2只能在/data/kefu2下活动

bash 复制代码
vim /etc/vsftpd/vsftpd.conf
chroot_local_user=YES
systemctl restart vsftpd

测试

错了

/data/kefu2

bash 复制代码
[root@code kefu2]# vim /etc/vsftpd/vsftpd.conf
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
local_enable=YES
local_root=/data/kefu2
chroot_local_user=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
userlist_enable=YES
tcp_wrappers=YES
[root@code kefu2]# cd /data/kefu2
[root@code kefu2]# ls
[root@code kefu2]# systemctl restart vsftpd
您在 /var/spool/mail/root 中有邮件

登录成功

计划下载ftp专用软件

FlashFXP



连接成功

无法点击上级目录

禁锢成功

如何退出ftp命令行

quit

bash 复制代码
[root@code kefu2]# ftp 192.168.235.100
ftp: connect: 拒绝连接
ftp>

ftp:connect:拒绝连接

192.168.235.100

bash 复制代码
[root@code caozx26420]# cat /etc/host.deny
cat: /etc/host.deny: 没有那个文件或目录
[root@code caozx26420]# cat /etc/hosts.deny
#
# hosts.deny    This file contains access rules which are used to
#               deny connections to network services that either use
#               the tcp_wrappers library or that have been
#               started through a tcp_wrappers-enabled xinetd.
#
#               The rules in this file can also be set up in
#               /etc/hosts.allow with a 'deny' option instead.
#
#               See 'man 5 hosts_options' and 'man 5 hosts_access'
#               for information on rule syntax.
#               See 'man tcpd' for information on tcp_wrappers
#
[root@code caozx26420]#
[root@code caozx26420]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
[root@code caozx26420]# systemctl start vsftpd
[root@code caozx26420]# systemctl status vsftpd
● vsftpd.service - Vsftpd ftp daemon
   Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
   Active: active (running) since 六 2025-06-07 19:24:38 CST; 10s ago
  Process: 54009 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
 Main PID: 54012 (vsftpd)
    Tasks: 1
   CGroup: /system.slice/vsftpd.service
           └─54012 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf

6月 07 19:24:38 code systemd[1]: Starting Vsftpd ftp daemon...
6月 07 19:24:38 code systemd[1]: Started Vsftpd ftp daemon.
[root@code caozx26420]#

192.168.235.20

bash 复制代码
[root@code kefu2]# ftp 192.168.235.100
ftp: connect: 拒绝连接
ftp> ftp 192.168.235.100
?Invalid command
ftp> bye
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]# ftp 192.168.235.100
Connected to 192.168.235.100 (192.168.235.100).
220 (vsFTPd 3.0.2)
Name (192.168.235.100:root): caozx26420
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

貌似服务器192.168.235.100没有上传权限

测试服务器192.168.235.20的上传权限

bash 复制代码
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]# ll -d /data/kefu2
drwxr-xr-x. 2 root root 6 6月   7 18:22 /data/kefu2
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]# setfacl -R -m u:kefu2:rwx /data/kefu2
您在 /var/spool/mail/root 中有邮件
[root@code kefu2]# systemctl restart vsftpd
[root@code kefu2]#
500OPS
bash 复制代码
  allow_writeable_chroot
              Allow chroot()'ing a user to a directory writable by that user. Note that setting this to YES is potentially  dangerous.
              For  example,  if  the  user  creates  an  'etc' directory in the new root directory, they could potentially trick the C
              library into loading a user-created configuration file from the /etc/ directory.

              Default: NO

allow_writeable_chroot

允许将用户 chroot() 到一个可由该用户写入的目录。请注意,将此设置为 YES 具有潜在危险。

例如,如果用户在新的根目录中创建一个 'etc' 目录,他们可能会诱骗 C 库从 /etc/ 目录加载用户创建的配置文件。

默认值: NO

怎么理解chmod a-w

bash 复制代码
[root@code vsftpd]# jobs
[root@code vsftpd]# /usr/local/
-bash: /usr/local/: 是一个目录
[root@code vsftpd]# ls
ftpusers  user_list  vsftpd.conf  vsftpd_conf_migrate.sh
您在 /var/spool/mail/root 中有邮件
[root@code vsftpd]# cd /usr/local/bin
[root@code bin]# ls
inotify.sh  inotifywait  inotifywatch  nohup.out
[root@code bin]# nohup ./inotify.sh &
[1] 104715
[root@code bin]# nohup: 忽略输入并把输出追加到"nohup.out"
jobs
[1]+  运行中               nohup ./inotify.sh &
[root@code bin]# jobs
[1]+  运行中               nohup ./inotify.sh &
[root@code bin]#
为什么原本后台运行的inotify.sh进程没有 是因为虚拟机挂起 还是因为systemctl restart vsftpd

inotify.sh的主要内容是实时监控同步192.168.235.100的指定目录

bash 复制代码
[root@code bin]# cat inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java  |while read events
do
  rsync  -av -e "ssh -p 3333" --delete /root/app/java/ [email protected]:/home/code/backup/java_backup/
  echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done

ai称:intify.sh与vsftpd进程存在依赖关系 感觉不对

与xinetd有关系吗?

bash 复制代码
[root@code bin]# jobs
[1]+  运行中               nohup ./inotify.sh &
[root@code bin]# cat inotify.sh
#!/bin/bash
/usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java  |while read events
do
  rsync  -av -e "ssh -p 3333" --delete /root/app/java/ [email protected]:/home/code/backup/java_backup/
  echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1
done

您在 /var/spool/mail/root 中有邮件
[root@code bin]# jobs
[1]+  运行中               nohup ./inotify.sh &
您在 /var/spool/mail/root 中有邮件
[root@code bin]# systemctl restart vsftpd
[root@code bin]# jobs
[1]+  运行中               nohup ./inotify.sh &
[root@code bin]# ss -naltp|grep 873
LISTEN     0      64        [::]:873                   [::]:*                   users:(("xinetd",pid=64785,fd=5))
您在 /var/spool/mail/root 中有邮件
[root@code bin]#

计划后面再观察下 inotify.sh 会不会重启;这里重启了vsftpd服务 ,inotify.sh仍在运行;xinetd后台仍在运行

还是失败 不能上传

[root@code caozx26420]# cd ~

root@code \~\]# ls @后的code是什么 caozx26420是什么 cd \~去哪里 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/b81adaa43ed1407e9641e675aecfe099.png) ```bash Name (192.168.235.20:root): kefu2 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> put /root/ab.txt local: /root/ab.txt remote: /root/ab.txt 227 Entering Passive Mode (192,168,235,20,93,66). 553 Could not create file. ``` ##### 553 Could not create file.啥意思 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/46541b51ed4d4042a1cc727f8dc42406.png) 还是不行吗? ```bash 您在 /var/spool/mail/root 中有邮件 [root@code bin]# ll -d /data/kefu2 drwxrwxr-x+ 2 root root 15 6月 7 20:46 /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code bin]# setfacl -R -m u:kefu2:rwx /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code bin]# systemctl restart vsftpd [root@code bin]# ll -d /data/kefu2 drwxrwxr-x+ 2 root root 15 6月 7 20:46 /data/kefu2 [root@code bin]# ``` ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/48733751680946f5ba028dae62c25e8f.png) \[root@code bin\]# setfacl -R -m u:kefu2:rwx /data/kefu2 您在 /var/spool/mail/root 中有邮件 \[root@code bin\]# systemctl restart vsftpd \[root@code bin\]# ll -d /data/kefu2 drwxrwxr-x+ 2 root root 15 6月 7 20:46 /data/kefu2 \[root@code bin\]# 为什么使用kefu2连接ftp 192.168.235.20后 不能上传文件到/data/kefu2 下载可以吗不行 之前理解也不对 上传=本地文件 到 该服务器 下载=从服务器 到 本地 对的 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/50508dedbae74467a9970caf54094ab8.png) 又可以了 推测刚才是另一个服务器 192.168.235.100的问题 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/e0ee93c29d9443518d231c1bda43e700.png) 上传、下载都成功了 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/1548957153e84d10bb4246ef32d27bfc.png) 也可以啊 推测是互传的问题 计划测试 ```bash ftp> get /home/caozx26420/525.txt local: ./home/caozx26420/525.txt remote: /home/caozx26420/525.txt local: ./home/caozx26420/525.txt: 没有那个文件或目录 ftp> get /home/caozx26420/525.txt local: ./home/caozx26420/525.txt remote: /home/caozx26420/525.txt local: ./home/caozx26420/525.txt: 没有那个文件或目录 ftp> cd /home/caozx26420 250 Directory successfully changed. ftp> ls 227 Entering Passive Mode (192,168,235,100,201,100). 150 Here comes the directory listing. -rw-rwxr-- 1 1000 1000 34876 May 25 01:22 525.txt -rw------- 1 1000 1000 318636032 May 24 14:43 core.2691 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 下载 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 公共 drwxr-xr-x 2 1000 1000 53 May 25 01:15 图片 -rw-r--r-- 1 1000 1000 2897 Jun 17 2024 复仇女神4.png drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 文档 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 桌面 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 模板 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 视频 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 音乐 226 Directory send OK. ftp> get 525.txt local: 525.txt remote: 525.txt 227 Entering Passive Mode (192,168,235,100,109,4). 150 Opening BINARY mode data connection for 525.txt (34876 bytes). 226 Transfer complete. 34876 bytes received in 8.2e-05 secs (425317.09 Kbytes/sec) ftp> cd / 250 Directory successfully changed. ftp> ls 227 Entering Passive Mode (192,168,235,100,118,151). 150 Here comes the directory listing. -rw-r--r-- 1 0 0 6291456 May 20 13:37 35.txt drwxr-xr-x 2 0 0 6 May 19 14:32 aa1 drwxr-xr-x 2 0 0 6 May 19 14:32 aa2 drwxr-xr-x 2 0 0 6 May 19 14:32 aa3 lrwxrwxrwx 1 0 0 7 Apr 20 18:28 bin -> usr/bin dr-xr-xr-x 5 0 0 4096 Apr 20 18:38 boot drwxr-xr-x 20 0 0 3300 Apr 20 19:31 dev drwxr-xr-x 146 0 0 8192 Jun 07 10:19 etc drwxr-xr-x 2 0 0 6 May 19 14:30 file1.java -rw-r--r-- 1 0 0 0 May 20 13:38 file19.java drwxr-xr-x 2 0 0 6 May 19 14:30 file2.java -rw-r--r-- 1 0 0 0 May 20 13:38 file20.java -rw-r--r-- 1 0 0 0 May 20 13:38 file21.java -rw-r--r-- 1 0 0 0 May 20 13:38 file22.java -rw-r--r-- 1 0 0 0 May 20 13:38 file23.java drwxr-xr-x 2 0 0 6 May 19 14:30 file3.java drwxr-xr-x 2 0 0 6 May 19 14:30 file4.java drwxr-xr-x 2 0 0 6 May 19 14:30 file5.java drwxr-xr-x 2 0 0 6 May 19 14:30 file6.java drwxr-xr-x 2 0 0 6 May 19 14:30 file7.java drwxr-xr-x 5 0 0 48 Jun 04 12:57 home lrwxrwxrwx 1 0 0 7 Apr 20 18:28 lib -> usr/lib lrwxrwxrwx 1 0 0 9 Apr 20 18:28 lib64 -> usr/lib64 drwxr-xr-x 2 0 0 6 Apr 11 2018 media drwxr-xr-x 8 1000 1000 2048 Nov 04 2020 mnt drwxr-xr-x 2 0 0 21 Apr 20 12:06 ok drwxr-xr-x 3 0 0 16 Apr 20 18:33 opt dr-xr-xr-x 234 0 0 0 Apr 20 19:31 proc dr-xr-x--- 7 0 0 4096 Jun 07 11:01 root drwxr-xr-x 44 0 0 1280 Jun 07 10:19 run lrwxrwxrwx 1 0 0 8 Apr 20 18:28 sbin -> usr/sbin drwxr-xr-x 2 0 0 6 Apr 11 2018 srv dr-xr-xr-x 13 0 0 0 Apr 20 19:31 sys drwxrwxrwt 16 0 0 4096 Jun 07 11:31 tmp drwxr-xr-x 13 0 0 155 Apr 20 18:28 usr drwxr-xr-x 22 0 0 4096 May 29 12:55 var 226 Directory send OK. ftp> get file20.java local: file20.java remote: file20.java 227 Entering Passive Mode (192,168,235,100,188,252). 150 Opening BINARY mode data connection for file20.java (0 bytes). 226 Transfer complete. ftp> cd / ``` 下载貌似成功了?192.168.235.20下载192.168.235.100 ```bash ftp> put /data/kefu2/6 local: /data/kefu2/6 remote: /data/kefu2/6 227 Entering Passive Mode (192,168,235,100,198,187). 553 Could not create file. ``` 但是上传不成功?192.168.235.20上传192.168.235.100 ```bash [root@code kefu2]# ls 6 AutoMathSetting.dat ControlMappings.xml GameData.dat 复仇女神2.png [root@code kefu2]# ``` 下载到哪里去了? ```bash [root@code kefu2]# cd 您在 /var/spool/mail/root 中有邮件 [root@code ~]# ls 2-1.java alll1 app axel-2.4.tar.gz cc.conf initial-setup-ks.cfg ok readme7 2.java anaconda-ks.cfg axel-2.4 bb.conf code inotify-tools-3.13.tar.gz okl readme.txt [root@code ~]# cd / [root@code /]# ls app bin cc.conf data dev home lib media oo .pcapng proc root sbin srv tmp var app1 boot code date etc java lib64 mnt opt rhome run shop sys usr [root@code /]# find / -name 525.txt find: '/run/user/1000/gvfs': 权限不够 /usr/local/bin/525.txt [root@code /]# ll /usr/local/bin/525.txt -rw-r--r--. 1 root root 34876 6月 7 21:37 /usr/local/bin/525.txt 您在 /var/spool/mail/root 中有邮件 [root@code /]# find /usr/local/bin -name file20.java /usr/local/bin/file20.java 您在 /var/spool/mail/root 中有邮件 [root@code /]# ll /usr/local/bin/file20.java -rw-r--r--. 1 root root 0 6月 7 21:37 /usr/local/bin/file20.java ``` 找到了 尽量避免全盘搜索!!! 上传是没成功 ## 笔记![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/4e84bbc918e84510be7e2e5ac7b41f8e.jpeg) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/953c41e6f80643a08d7ada8e09a0ca6c.jpeg) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/009ca3871652467094198f409962277b.jpeg) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/921815b1c76f4911801f4983080085ff.jpeg) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/327a48c10e3341a1ba56ef05ef61abc6.jpeg) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/efa6cf531cae4631b81d87f97b56deba.jpeg) ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/fbf538bfffff43fb9f069cbb2c303c13.jpeg) ## 代码 192.168.235.20 ```bash [email protected]'s password: ┌────────────────────────────────────────────────────────────────────┐ │ • MobaXterm 20.0 • │ │ (SSH client, X-server and networking tools) │ │ │ │ ➤ SSH session to [email protected] │ │ • SSH compression : ✘ │ │ • SSH-browser : ✔ │ │ • X11-forwarding : ✔ (remote display is forwarded through SSH) │ │ • DISPLAY : ✔ (automatically set on remote server) │ │ │ │ ➤ For more info, ctrl+click on help or visit our website │ └────────────────────────────────────────────────────────────────────┘ Last login: Fri Jun 6 19:54:41 2025 from 192.168.235.1 [root@code ~]# tail -2 /etc/passwd jerry:x:1021:1229::/home/jerry:/bin/bash kefu:x:1022:1022::/home/kefu:/bin/bash [root@code ~]# useradd kefu2 [root@code ~]# tail -3 /etc/passwd jerry:x:1021:1229::/home/jerry:/bin/bash kefu:x:1022:1022::/home/kefu:/bin/bash kefu2:x:1023:1023::/home/kefu2:/bin/bash [root@code ~]# echo 123|passwd --stdin kefu2 更改用户 kefu2 的密码 。 passwd:所有的身份验证令牌已经成功更新。 您在 /var/spool/mail/root 中有新邮件 [root@code ~]# mkdir -p /data/kefu2 [root@code ~]# ls 2-1.java alll1 app axel-2.4.tar.gz cc.conf initial-setup-ks.cfg ok readme7 2.java anaconda-ks.cfg axel-2.4 bb.conf code inotify-tools-3.13.tar.gz okl readme.txt [root@code ~]# cd /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# grep ^# /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). # # Uncomment this to allow local users to log in. # When SELinux is enforcing check for SE bool ftp_home_dir # Uncomment this to enable any form of FTP write command. # # 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) # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. # # Activate logging of uploads/downloads. # # Make sure PORT transfer connections originate from port 20 (ftp-data). # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # 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. # # 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 !! 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf anonymous_enable=NO local_enable=YES local_root=/date/kefu chroot_local_user=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 userlist_enable=YES tcp_wrappers=YES [root@code kefu2]# vim /etc/vsftpd/vsftpd.conf 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf anonymous_enable=NO local_enable=YES local_root=/date/kefu2 chroot_local_user=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 userlist_enable=YES tcp_wrappers=YES [root@code kefu2]# systemctl restart ftpd Failed to restart ftpd.service: Unit not found. [root@code kefu2]# systemctl restart vsftpd 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# cat /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 local_root=/date/kefu2 chroot_local_user=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 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # 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 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf anonymous_enable=NO local_enable=YES local_root=/date/kefu2 chroot_local_user=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 userlist_enable=YES tcp_wrappers=YES [root@code kefu2]# vim /etc/vsftpd/vsftpd.conf 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf anonymous_enable=NO local_enable=YES local_root=/data/kefu2 chroot_local_user=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 userlist_enable=YES tcp_wrappers=YES [root@code kefu2]# cd /data/kefu2 [root@code kefu2]# ls [root@code kefu2]# systemctl restart vsftpd 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# ftp://192.168.235.100 -bash: ftp://192.168.235.100: 没有那个文件或目录 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# ftp ftp> 192.168.235.100 ?Invalid command ftp> ls Not connected. ftp> ^C ftp> ^C ftp> ftp> ftp://192.168.235.100 ?Invalid command ftp> ^C ftp> ftp 192.168.235.100 ?Invalid command ftp> ^C ftp> help Commands may be abbreviated. Commands are: ! debug mdir sendport site $ dir mget put size account disconnect mkdir pwd status append exit mls quit struct ascii form mode quote system bell get modtime recv sunique binary glob mput reget tenex bye hash newer rstatus tick case help nmap rhelp trace cd idle nlist rename type cdup image ntrans reset user chmod lcd open restart umask close ls prompt rmdir verbose cr macdef passive runique ? delete mdelete proxy send ftp> ^C ftp> ftp> ? Commands may be abbreviated. Commands are: ! debug mdir sendport site $ dir mget put size account disconnect mkdir pwd status append exit mls quit struct ascii form mode quote system bell get modtime recv sunique binary glob mput reget tenex bye hash newer rstatus tick case help nmap rhelp trace cd idle nlist rename type cdup image ntrans reset user chmod lcd open restart umask close ls prompt rmdir verbose cr macdef passive runique ? delete mdelete proxy send ftp> quit 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# ftp 192.168.235.100 ftp: connect: 拒绝连接 ftp> ftp 192.168.235.100 ?Invalid command ftp> bye 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# ftp 192.168.235.100 Connected to 192.168.235.100 (192.168.235.100). 220 (vsFTPd 3.0.2) Name (192.168.235.100:root): caozx26420 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> quit 221 Goodbye. 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# ll -d /data/kefu2 drwxr-xr-x. 2 root root 6 6月 7 18:22 /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# setfacl -R -m u:kefu2:rwx /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# systemctl restart vsftpd [root@code kefu2]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; enabled; vendor preset: disabled) Active: active (running) since 六 2025-06-07 19:39:48 CST; 2min 44s ago Process: 102286 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS) Main PID: 102288 (vsftpd) Tasks: 1 CGroup: /system.slice/vsftpd.service └─102288 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 6月 07 19:39:48 code systemd[1]: Stopped Vsftpd ftp daemon. 6月 07 19:39:48 code systemd[1]: Starting Vsftpd ftp daemon... 6月 07 19:39:48 code systemd[1]: Started Vsftpd ftp daemon. 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# vim /etc/vsftpd/vsftpd.conf 您在 /var/spool/mail/root 中有邮件 [root@code kefu2]# cat /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 local_root=/data/kefu2 chroot_local_user=YES # Uncomment this to enable any form of FTP write command. allow_writeable_chroot=YES 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 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. The vsftpd.conf(5) man page explains # the behaviour when these options are disabled. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # 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 [root@code kefu2]# grep -v ^# /etc/vsftpd/vsftpd.conf anonymous_enable=NO local_enable=YES local_root=/data/kefu2 chroot_local_user=YES 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 userlist_enable=YES tcp_wrappers=YES [root@code kefu2]# cd /etc/vsftpd/vsftpd.conf -bash: cd: /etc/vsftpd/vsftpd.conf: 不是目录 [root@code kefu2]# cd /etc/vsftpd [root@code vsftpd]# man 5 vsftpd.conf 您在 /var/spool/mail/root 中有邮件 [root@code vsftpd]# systemctl restart vsftpd [root@code vsftpd]# jobs [root@code vsftpd]# /usr/local/ -bash: /usr/local/: 是一个目录 [root@code vsftpd]# ls ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh 您在 /var/spool/mail/root 中有邮件 [root@code vsftpd]# cd /usr/local/bin [root@code bin]# ls inotify.sh inotifywait inotifywatch nohup.out [root@code bin]# nohup ./inotify.sh & [1] 104715 [root@code bin]# nohup: 忽略输入并把输出追加到"nohup.out" jobs [1]+ 运行中 nohup ./inotify.sh & [root@code bin]# jobs [1]+ 运行中 nohup ./inotify.sh & [root@code bin]# cat inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events do rsync -av -e "ssh -p 3333" --delete /root/app/java/ [email protected]:/home/code/backup/java_backup/ echo "$(date '+%F %T') fasheng$events" >> /var/log/rsync.log 2>&1 done 您在 /var/spool/mail/root 中有邮件 [root@code bin]# jobs [1]+ 运行中 nohup ./inotify.sh & 您在 /var/spool/mail/root 中有邮件 [root@code bin]# systemctl restart vsftpd [root@code bin]# jobs [1]+ 运行中 nohup ./inotify.sh & [root@code bin]# ss -naltp|grep 873 LISTEN 0 64 [::]:873 [::]:* users:(("xinetd",pid=64785,fd=5)) 您在 /var/spool/mail/root 中有邮件 [root@code bin]# ll -d /data/kefu2 drwxrwxr-x+ 2 root root 15 6月 7 20:46 /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code bin]# setfacl -R -m u:kefu2:rwx /data/kefu2 您在 /var/spool/mail/root 中有邮件 [root@code bin]# systemctl restart vsftpd [root@code bin]# ll -d /data/kefu2 drwxrwxr-x+ 2 root root 15 6月 7 20:46 /data/kefu2 [root@code bin]# ftp 192.168.235.100 Connected to 192.168.235.100 (192.168.235.100). 220 (vsFTPd 3.0.2) Name (192.168.235.100:root): caozx26420 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> get /home/caozx26420 525.txt local: 525.txt remote: /home/caozx26420 227 Entering Passive Mode (192,168,235,100,250,38). 550 Failed to open file. ftp> bye 221 Goodbye. 您在 /var/spool/mail/root 中有邮件 [root@code bin]# ftp 192.168.235.100 Connected to 192.168.235.100 (192.168.235.100). 220 (vsFTPd 3.0.2) Name (192.168.235.100:root): caozx26420 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> get /home/caozx26420/525.txt local: ./home/caozx26420/525.txt remote: /home/caozx26420/525.txt local: ./home/caozx26420/525.txt: 没有那个文件或目录 ftp> get /home/caozx26420/525.txt local: ./home/caozx26420/525.txt remote: /home/caozx26420/525.txt local: ./home/caozx26420/525.txt: 没有那个文件或目录 ftp> cd /home/caozx26420 250 Directory successfully changed. ftp> ls 227 Entering Passive Mode (192,168,235,100,201,100). 150 Here comes the directory listing. -rw-rwxr-- 1 1000 1000 34876 May 25 01:22 525.txt -rw------- 1 1000 1000 318636032 May 24 14:43 core.2691 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 下载 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 公共 drwxr-xr-x 2 1000 1000 53 May 25 01:15 图片 -rw-r--r-- 1 1000 1000 2897 Jun 17 2024 复仇女神4.png drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 文档 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 桌面 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 模板 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 视频 drwxr-xr-x 2 1000 1000 6 Apr 20 19:47 音乐 226 Directory send OK. ftp> get 525.txt local: 525.txt remote: 525.txt 227 Entering Passive Mode (192,168,235,100,109,4). 150 Opening BINARY mode data connection for 525.txt (34876 bytes). 226 Transfer complete. 34876 bytes received in 8.2e-05 secs (425317.09 Kbytes/sec) ftp> cd / 250 Directory successfully changed. ftp> ls 227 Entering Passive Mode (192,168,235,100,118,151). 150 Here comes the directory listing. -rw-r--r-- 1 0 0 6291456 May 20 13:37 35.txt drwxr-xr-x 2 0 0 6 May 19 14:32 aa1 drwxr-xr-x 2 0 0 6 May 19 14:32 aa2 drwxr-xr-x 2 0 0 6 May 19 14:32 aa3 lrwxrwxrwx 1 0 0 7 Apr 20 18:28 bin -> usr/bin dr-xr-xr-x 5 0 0 4096 Apr 20 18:38 boot drwxr-xr-x 20 0 0 3300 Apr 20 19:31 dev drwxr-xr-x 146 0 0 8192 Jun 07 10:19 etc drwxr-xr-x 2 0 0 6 May 19 14:30 file1.java -rw-r--r-- 1 0 0 0 May 20 13:38 file19.java drwxr-xr-x 2 0 0 6 May 19 14:30 file2.java -rw-r--r-- 1 0 0 0 May 20 13:38 file20.java -rw-r--r-- 1 0 0 0 May 20 13:38 file21.java -rw-r--r-- 1 0 0 0 May 20 13:38 file22.java -rw-r--r-- 1 0 0 0 May 20 13:38 file23.java drwxr-xr-x 2 0 0 6 May 19 14:30 file3.java drwxr-xr-x 2 0 0 6 May 19 14:30 file4.java drwxr-xr-x 2 0 0 6 May 19 14:30 file5.java drwxr-xr-x 2 0 0 6 May 19 14:30 file6.java drwxr-xr-x 2 0 0 6 May 19 14:30 file7.java drwxr-xr-x 5 0 0 48 Jun 04 12:57 home lrwxrwxrwx 1 0 0 7 Apr 20 18:28 lib -> usr/lib lrwxrwxrwx 1 0 0 9 Apr 20 18:28 lib64 -> usr/lib64 drwxr-xr-x 2 0 0 6 Apr 11 2018 media drwxr-xr-x 8 1000 1000 2048 Nov 04 2020 mnt drwxr-xr-x 2 0 0 21 Apr 20 12:06 ok drwxr-xr-x 3 0 0 16 Apr 20 18:33 opt dr-xr-xr-x 234 0 0 0 Apr 20 19:31 proc dr-xr-x--- 7 0 0 4096 Jun 07 11:01 root drwxr-xr-x 44 0 0 1280 Jun 07 10:19 run lrwxrwxrwx 1 0 0 8 Apr 20 18:28 sbin -> usr/sbin drwxr-xr-x 2 0 0 6 Apr 11 2018 srv dr-xr-xr-x 13 0 0 0 Apr 20 19:31 sys drwxrwxrwt 16 0 0 4096 Jun 07 11:31 tmp drwxr-xr-x 13 0 0 155 Apr 20 18:28 usr drwxr-xr-x 22 0 0 4096 May 29 12:55 var 226 Directory send OK. ftp> get file20.java local: file20.java remote: file20.java 227 Entering Passive Mode (192,168,235,100,188,252). 150 Opening BINARY mode data connection for file20.java (0 bytes). 226 Transfer complete. ftp> cd / 250 Directory successfully changed. ftp> ls 227 Entering Passive Mode (192,168,235,100,29,89). 150 Here comes the directory listing. -rw-r--r-- 1 0 0 6291456 May 20 13:37 35.txt drwxr-xr-x 2 0 0 6 May 19 14:32 aa1 drwxr-xr-x 2 0 0 6 May 19 14:32 aa2 drwxr-xr-x 2 0 0 6 May 19 14:32 aa3 lrwxrwxrwx 1 0 0 7 Apr 20 18:28 bin -> usr/bin dr-xr-xr-x 5 0 0 4096 Apr 20 18:38 boot drwxr-xr-x 20 0 0 3300 Apr 20 19:31 dev drwxr-xr-x 146 0 0 8192 Jun 07 10:19 etc drwxr-xr-x 2 0 0 6 May 19 14:30 file1.java -rw-r--r-- 1 0 0 0 May 20 13:38 file19.java drwxr-xr-x 2 0 0 6 May 19 14:30 file2.java -rw-r--r-- 1 0 0 0 May 20 13:38 file20.java -rw-r--r-- 1 0 0 0 May 20 13:38 file21.java -rw-r--r-- 1 0 0 0 May 20 13:38 file22.java -rw-r--r-- 1 0 0 0 May 20 13:38 file23.java drwxr-xr-x 2 0 0 6 May 19 14:30 file3.java drwxr-xr-x 2 0 0 6 May 19 14:30 file4.java drwxr-xr-x 2 0 0 6 May 19 14:30 file5.java drwxr-xr-x 2 0 0 6 May 19 14:30 file6.java drwxr-xr-x 2 0 0 6 May 19 14:30 file7.java drwxr-xr-x 5 0 0 48 Jun 04 12:57 home lrwxrwxrwx 1 0 0 7 Apr 20 18:28 lib -> usr/lib lrwxrwxrwx 1 0 0 9 Apr 20 18:28 lib64 -> usr/lib64 drwxr-xr-x 2 0 0 6 Apr 11 2018 media drwxr-xr-x 8 1000 1000 2048 Nov 04 2020 mnt drwxr-xr-x 2 0 0 21 Apr 20 12:06 ok drwxr-xr-x 3 0 0 16 Apr 20 18:33 opt dr-xr-xr-x 234 0 0 0 Apr 20 19:31 proc dr-xr-x--- 7 0 0 4096 Jun 07 11:01 root drwxr-xr-x 44 0 0 1280 Jun 07 10:19 run lrwxrwxrwx 1 0 0 8 Apr 20 18:28 sbin -> usr/sbin drwxr-xr-x 2 0 0 6 Apr 11 2018 srv dr-xr-xr-x 13 0 0 0 Apr 20 19:31 sys drwxrwxrwt 16 0 0 4096 Jun 07 11:31 tmp drwxr-xr-x 13 0 0 155 Apr 20 18:28 usr drwxr-xr-x 22 0 0 4096 May 29 12:55 var 226 Directory send OK. ftp> cd /home 250 Directory successfully changed. ftp> ls 227 Entering Passive Mode (192,168,235,100,133,99). 150 Here comes the directory listing. drwx------ 15 1000 1000 4096 Jun 07 13:27 caozx26420 drwx------ 8 1001 1001 232 Jun 07 11:01 code drwx------ 3 1002 1002 78 Jun 04 12:57 kefu 226 Directory send OK. ftp> cd /data/kehu2 550 Failed to change directory. ftp> put /data/kehu2/6 local: /data/kehu2/6 remote: /data/kehu2/6 local: /data/kehu2/6: 没有那个文件或目录 ftp> put /data/kefu2/6 local: /data/kefu2/6 remote: /data/kefu2/6 227 Entering Passive Mode (192,168,235,100,198,187). 553 Could not create file. ftp> bye 221 Goodbye. 您在 /var/spool/mail/root 中有邮件 [root@code bin]# cd /data/kefu2 [root@code kefu2]# ls 6 AutoMathSetting.dat ControlMappings.xml GameData.dat 复仇女神2.png [root@code kefu2]# cd 您在 /var/spool/mail/root 中有邮件 [root@code ~]# ls 2-1.java alll1 app axel-2.4.tar.gz cc.conf initial-setup-ks.cfg ok readme7 2.java anaconda-ks.cfg axel-2.4 bb.conf code inotify-tools-3.13.tar.gz okl readme.txt [root@code ~]# cd / [root@code /]# ls app bin cc.conf data dev home lib media oo .pcapng proc root sbin srv tmp var app1 boot code date etc java lib64 mnt opt rhome run shop sys usr [root@code /]# find / -name 525.txt find: '/run/user/1000/gvfs': 权限不够 /usr/local/bin/525.txt [root@code /]# ll /usr/local/bin/525.txt -rw-r--r--. 1 root root 34876 6月 7 21:37 /usr/local/bin/525.txt 您在 /var/spool/mail/root 中有邮件 [root@code /]# find /usr/local/bin -name file20.java /usr/local/bin/file20.java 您在 /var/spool/mail/root 中有邮件 [root@code /]# ll /usr/local/bin/file20.java -rw-r--r--. 1 root root 0 6月 7 21:37 /usr/local/bin/file20.java [root@code /]# ``` 192.168.235.100 ```bash [email protected]'s password: ▒▒▒ʱ▒▒ܾ▒ [email protected]'s password: ┌────────────────────────────────────────────────────────────────────┐ │ • MobaXterm 20.0 • │ │ (SSH client, X-server and networking tools) │ │ │ │ ➤ SSH session to [email protected] │ │ • SSH compression : ✘ │ │ • SSH-browser : ✔ │ │ • X11-forwarding : ✔ (remote display is forwarded through SSH) │ │ • DISPLAY : ✔ (automatically set on remote server) │ │ │ │ ➤ For more info, ctrl+click on help or visit our website │ └────────────────────────────────────────────────────────────────────┘ Last failed login: Sat Jun 7 18:19:58 CST 2025 from 192.168.235.1 on ssh:notty There was 1 failed login attempt since the last successful login. Last login: Fri Jun 6 19:54:34 2025 from 192.168.235.1 [code@code ~]$ su - caozx26420 密码: 上一次登录:四 6月 5 19:31:02 CST 2025pts/3 上 [caozx26420@code ~]$ sudo su [sudo] caozx26420 的密码: [root@code caozx26420]# rpm -qa|grep ftp lftp-4.4.8-12.el7_8.1.x86_64 vsftpd-3.0.2-28.el7.x86_64 ftp-0.17-67.el7.x86_64 [root@code caozx26420]# grep -v ^# /etc/vsftpd/vsftpd.conf anonymous_enable=YES local_enable=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 userlist_enable=YES tcp_wrappers=YES [root@code caozx26420]# tail -5 /etc/passwd postfix:x:89:89::/var/spool/postfix:/sbin/nologin tcpdump:x:72:72::/:/sbin/nologin caozx26420:x:1000:1000:caozx26420:/home/caozx26420:/bin/bash code:x:1001:1001::/home/code:/bin/bash kefu:x:1002:1002::/home/kefu:/bin/bash [root@code caozx26420]# ping www.baidu.com PING www.wshifen.com (103.235.46.102) 56(84) bytes of data. 64 bytes from 103.235.46.102 (103.235.46.102): icmp_seq=1 ttl=128 time=132 ms 64 bytes from 103.235.46.102 (103.235.46.102): icmp_seq=2 ttl=128 time=128 ms ^C --- www.wshifen.com ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 128.292/130.513/132.734/2.221 ms [root@code caozx26420]# cat /etc/host.deny cat: /etc/host.deny: 没有那个文件或目录 [root@code caozx26420]# cat /etc/hosts.deny # # hosts.deny This file contains access rules which are used to # deny connections to network services that either use # the tcp_wrappers library or that have been # started through a tcp_wrappers-enabled xinetd. # # The rules in this file can also be set up in # /etc/hosts.allow with a 'deny' option instead. # # See 'man 5 hosts_options' and 'man 5 hosts_access' # for information on rule syntax. # See 'man tcpd' for information on tcp_wrappers # [root@code caozx26420]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled) Active: inactive (dead) [root@code caozx26420]# systemctl start vsftpd [root@code caozx26420]# systemctl status vsftpd ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled) Active: active (running) since 六 2025-06-07 19:24:38 CST; 10s ago Process: 54009 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS) Main PID: 54012 (vsftpd) Tasks: 1 CGroup: /system.slice/vsftpd.service └─54012 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf 6月 07 19:24:38 code systemd[1]: Starting Vsftpd ftp daemon... 6月 07 19:24:38 code systemd[1]: Started Vsftpd ftp daemon. [root@code caozx26420]# ftp 192.168.235.20 Connected to 192.168.235.20 (192.168.235.20). 220 (vsFTPd 3.0.2) Name (192.168.235.20:root): kefu2 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 227 Entering Passive Mode (192,168,235,20,66,99). 150 Here comes the directory listing. -rw-r--r-- 1 1023 1023 0 Jun 07 12:46 6 226 Directory send OK. ftp> quit 221 Goodbye. [root@code caozx26420]# ls 525.txt core.2691 公共 模板 视频 图片 文档 下载 音乐 桌面 [root@code caozx26420]# cd1 bash: cd1: 未找到命令... [root@code caozx26420]# ls 525.txt core.2691 公共 模板 视频 图片 文档 下载 音乐 桌面 [root@code caozx26420]# cd ~ [root@code ~]# ls ab.txt anaconda-ks.cfg bb.conf initial-setup-ks.cfg kk.txt ok sun.conf sun.txt [root@code ~]# ftp 192.168.235.20 Connected to 192.168.235.20 (192.168.235.20). 220 (vsFTPd 3.0.2) Name (192.168.235.20:root): kefu2 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> put /root/ab.txt local: /root/ab.txt remote: /root/ab.txt 227 Entering Passive Mode (192,168,235,20,93,66). 553 Could not create file. ftp> byevye ?Invalid command ftp> bye 421 Timeout. [root@code ~]# ls / 35.txt aa3 dev file1.java file22.java file3.java file6.java lib mnt proc sbin tmp aa1 bin etc file20.java file23.java file4.java file7.java lib64 ok root srv usr aa2 boot file19.java file21.java file2.java file5.java home media opt run sys var [root@code ~]# cd /home/caozzx26420 bash: cd: /home/caozzx26420: 没有那个文件或目录 [root@code ~]# cd /home/caozx26420 [root@code caozx26420]# ls\ > ^C [root@code caozx26420]# ls 525.txt core.2691 复仇女神4.png 公共 模板 视频 图片 文档 下载 音乐 桌面 [root@code caozx26420]# ll 525.txt -rw-rw-r--. 1 caozx26420 caozx26420 34876 5月 25 09:22 525.txt [root@code caozx26420]# setfacl -R -m u:caozx26420:rwx /home/caozx26420/525.txt [root@code caozx26420]# ll 525.txt -rw-rwxr--+ 1 caozx26420 caozx26420 34876 5月 25 09:22 525.txt [root@code caozx26420]# cd / [root@code /]# ls 35.txt aa3 dev file1.java file22.java file3.java file6.java lib mnt proc sbin tmp aa1 bin etc file20.java file23.java file4.java file7.java lib64 ok root srv usr aa2 boot file19.java file21.java file2.java file5.java home media opt run sys var [root@code /]# cd /home [root@code home]# cd caozx26420 [root@code caozx26420]# ls 525.txt core.2691 复仇女神4.png 公共 模板 视频 图片 文档 下载 音乐 桌面 [root@code caozx26420]# ```

相关推荐
tiandyoin6 天前
Chrome 通过FTP,HTTP 调用 Everything 浏览和搜索本地文件系统
前端·chrome·http·ftp·everything
五月高高12 天前
频繁报FTPResponse 421 received.Server closed connection
ftp
bcbobo21cn13 天前
了解FTP搜索引擎
搜索引擎·ftp·ftp搜索
前进的程序员16 天前
FTP 协议介绍与 C 语言开发案例
网络协议·ftp
习惯就好zz2 个月前
ubuntu1804服务器开启ftp,局域网共享特定文件给匿名用户
ubuntu·ftp·anonymous
virelin_Y.lin2 个月前
系统与网络安全------网络通信原理(6)
安全·web安全·应用层·ftp·dns·telnet
virelin_Y.lin2 个月前
系统与网络安全------Windows系统安全(7)
windows·web安全·系统安全·ftp
H轨迹H2 个月前
Hack The Box-Cap靶机
网络安全·渗透测试·kali·ftp·web漏洞·oscp
周全全4 个月前
CentOS7 安装配置FTP服务
运维·arm开发·centos·ftp·linu