当前位置: 首页 > news >正文

拍卖网站咋做医疗电子网站建设

拍卖网站咋做,医疗电子网站建设,成都建筑装饰设计公司,可以做网站素材的服装怎么把java文件夹给传过去了 rsync inotify 监控代码实时传输调试 没看到日志 这里面有了 rsync -essh -p 3712 -av /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/ 文件夹后面的/要加上 [rootlocalhost java]# cat /var/log/rsync.log… 怎么把java文件夹给传过去了 rsync inotify 监控代码实时传输调试 没看到日志 这里面有了 rsync -essh -p 3712 -av /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/ 文件夹后面的/要加上 [rootlocalhost java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java echo “ ( d a t e ′ (date %F %T) fasheng (date′events” /var/log/rsync.log 21 [rootlocalhost java]# cat /var/log/rsync.log 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 ‘date%F\ %T’ fasheng/root/app/java/ CREATE 321.java ‘date%F\ %T’ fasheng/root/app/java/ MODIFY 321.java ‘date%F\ %T’ fasheng/root/app/java/ CREATE 21.java ‘date%F\ %T’ fasheng/root/app/java/ ATTRIB 21.java ‘date%F\ %T’ fasheng/root/app/java/ CREATE 34.txt ‘date%F\ %T’ fasheng/root/app/java/ ATTRIB 34.txt ‘date%F\ %T’ fasheng/root/app/java/ CREATE 322.java ‘date%F\ %T’ fasheng/root/app/java/ MODIFY 322.java ‘date%F\ %T’ fasheng/root/app/java/ CREATE 333.java ‘date%F\ %T’ fasheng/root/app/java/ MODIFY 333.java 问题为什么倒数几行不显示传输的具体时间 我配置了inotify.sh主要作用是当监控到源文件夹中文件变化时将源文件夹中文件同步到目标主机目标文件夹并使用echo ( d a t e ′ (date %F %T) fasheng (date′events /var/log/rsync.log 21 两个问题1.修改shell后是否需要重新nohup ./.sh 看日志没有同步记录 2.rsync --delete 同步是以源文件夹为准 进行删除吗 参考 2.是 1.计划试一下 没有变化 看上去是同步了 但是日志里没有记录 没监控到 确实把目标主机的删了 和源主机的同步了 #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -e(ssh -p 3712) -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F\ %T) fasheng$events /var/log/rsync.log 21 done 为什么192.168.235.100/home/code/backup/java_backup 出现新文件时/root/app/java没有同步删除 /home/code/backup/java_backup中的文件日志中没有监控记录 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java 没看到变化 为啥没同步过去 要有免密登录才能实时传吗 免密登录 手动能传过去 为什么不能监控备份呢 计划删掉输出到日志文件看下 不能监控备份 是因为inotifywait 失效吗 [caozx26code java]$ cd /home/caozx26 [caozx26code ~]$ ls app 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ #code是什么意思code是什么意思我现在不在code目录下 前后表达的含义 确实 我的inotify.sh在/usr/local/bin/目录下在其他目录直接执行nohup ./inotify.sh 能顺利运行该进程吗是什么意思 根据你的问题以下是详细解答 一、能否在其他目录直接运行 nohup ./inotify.sh ​​答案不能直接运行​​。原因如下 ​​路径问题​​./inotify.sh 表示执行当前目录下的 inotify.sh 脚本。如果你的脚本实际位于 /usr/local/bin/ 目录且当前工作目录不在 /usr/local/bin则系统会提示找不到文件。 ​​正确执行方式​​ ​​使用绝对路径​​nohup /usr/local/bin/inotify.sh 。 ​​利用 PATH 环境变量​​若 /usr/local/bin 已加入系统 PATH可直接通过脚本名执行nohup inotify.sh 。 二、 符号的作用 是 Linux 中用于将命令放入后台运行的符号具体功能包括 ​​后台执行​​命令不会阻塞终端用户可继续输入其他操作。 ​​输出控制​​ 默认情况下后台进程的输出会显示在终端可能干扰当前操作。 建议结合输出重定向如 output.log 21避免输出混乱。 ​​进程管理​​ 通过 jobs 查看后台任务列表fg %n 将任务带回前台kill %n 终止任务。 若未使用 nohup终端关闭后后台任务会被终止因收到 SIGHUP 信号。 若intofy.sh在/usr/local/bin目录下进入/usr/local/bin然后直接运行nohup ./inotify.sh 可以吗如果成功运行了inotify.sh中的内容是否就可以一直执行了 ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2]不是已经指定了端口访问 为什么nohup.out 还是报错 port22 #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -essh -p 3712 -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F\ %T) fasheng$events /var/log/rsync.log 21 done [rootlocalhost bin]# rsync -e “ssh -p 3712” -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/ sending incremental file list deleting 34.txt ./ sent 476 bytes received 39 bytes 1,030.00 bytes/sec total size is 6,291,456 speedup is 12,216.42 单独执行rsync语句有用为什么一放到inotify.sh脚本文件中就不执行。/var/log/rsync.log记录了删除记录。nohup.out中都是错误记录ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] [rootlocalhost bin]# [rootlocalhost bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events do rsync -e “ssh -p 3712” -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/ echo “ ( d a t e (date %F\ %T) fasheng (dateevents” /var/log/rsync.log 21 done 改回来报错 b把默认端口改为22试试 ssh code192.168.235.100 ssh: connect to host 192.168.235.100 port 22: Connection refused a [rootlocalhost bin]# vim /usr/local/bin/inotify.sh 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F\ %T) fasheng$events /var/log/rsync.log 21 done [rootlocalhost bin]# cd /root/app/java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# ls 66.java 69.java aa3 file20.java file23.java file4.java file7.java 67.java aa1 file19.java file21.java file2.java file5.java 68.java aa2 file1.java file22.java file3.java file6.java [rootlocalhost java]# rm -rf 66.java [rootlocalhost java]# ls 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java [rootlocalhost java]# ls 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# rm -rf 67.java [rootlocalhost java]# ls 68.java aa2 file1.java file22.java file3.java file6.java 69.java aa3 file20.java file23.java file4.java file7.java aa1 file19.java file21.java file2.java file5.java [rootlocalhost java]# b: [rootlocalhost bin]# vim /usr/local/bin/inotify.sh 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F\ %T) fasheng$events /var/log/rsync.log 21 done [rootlocalhost bin]# cd /root/app/java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# ls 66.java 69.java aa3 file20.java file23.java file4.java file7.java 67.java aa1 file19.java file21.java file2.java file5.java 68.java aa2 file1.java file22.java file3.java file6.java [rootlocalhost java]# rm -rf 66.java [rootlocalhost java]# ls 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java [rootlocalhost java]# ls 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# rm -rf 67.java [rootlocalhost java]# ls 68.java aa2 file1.java file22.java file3.java file6.java 69.java aa3 file20.java file23.java file4.java file7.java aa1 file19.java file21.java file2.java file5.java [rootlocalhost java]# 现在同步成功了 推测应该是port 的问题 a: [rootlocalhost java]# cd /usr/local/bin 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ls inotify.sh inotifywait inotifywatch nohup.out [rootlocalhost bin]# cat nohup.out ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ./inotify.sh:行4: 未预期的符号 ( 附近有语法错误 ./inotify.sh:行4: rsync -e(ssh -p 3712) -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] sending incremental file list deleting 66.java deleting 35.txt ./sent 437 bytes received 50 bytes 324.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file list deleting 67.java ./sent 418 bytes received 40 bytes 916.00 bytes/sec total size is 0 speedup is 0.00查看nohup可以看到成功同步了 推测之前的应该是端口无法在shell中识别 之前配置过 /usr/local/bin/inotifywait -mrq -e create,move,delete,attrib,modify /root/app/java |while read events dorsync -essh -p 3712 -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup #echodate %F\ %T SHIJIAN$events/var/log/rsync.log 本句语法推测有点问题 rsync.log中时间不能显示 故注掉 done还配置过 rsync -e/usr/bin/ssh -p 3712 -av --delete / :这种形式 也没同步成功 计划再尝试下吧 看看能不能同步成功 cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java date%F\ %T fasheng/root/app/java/ DELETE 67.java date%F\ %T fasheng/root/app/java/ CREATE aa4 date%F\ %T fasheng/root/app/java/ ATTRIB aa4 date%F\ %T fasheng/root/app/java/ CREATE aa5 date%F\ %T fasheng/root/app/java/ ATTRIB aa5 date%F\ %T fasheng/root/app/java/ DELETE 68.java [rootcode java]# cat /usr/local/bin/inotfy.sh cat: /usr/local/bin/inotfy.sh: 没有那个文件或目录 [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo date %F\ %T fasheng$events /var/log/rsync.log 21 done 为什么/var/log/rsync.log中没有呈现具体的时间‘date%F\ %T’ fasheng/root/app/java/ DELETE 68.java 之前改过 echo “ ( d a t e (date %F\ %T) fas (dateevents”/var/log/rsync.log 21这种形式/var/log/rsync.log中也没有呈现具体的时间 [rootcode java]# rm -rf 69.java [rootcode java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java date%F\ %T fasheng/root/app/java/ DELETE 67.java date%F\ %T fasheng/root/app/java/ CREATE aa4 date%F\ %T fasheng/root/app/java/ ATTRIB aa4 date%F\ %T fasheng/root/app/java/ CREATE aa5 date%F\ %T fasheng/root/app/java/ ATTRIB aa5 date%F\ %T fasheng/root/app/java/ DELETE 68.java date%F\ %T fasheng/root/app/java/ DELETE 69.java [rootcode java]# ls -l /etc/localtime lrwxrwxrwx. 1 root root 35 4月 19 17:20 /etc/localtime - ../usr/share/zoneinfo/Asia/Shanghai[rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done 修改了后还是/var/log/rsync.log中还是不输出时间 a: [rootcode java]# pkill -f inotify.sh [rootcode java]# /usr/local/bin/inotify/sh [1] 37918 [rootcode java]# bash: /usr/local/bin/inotify/sh: 没有那个文件或目录 ^C [1] 退出 127 /usr/local/bin/inotify/sh [rootcode java]# /usr/local/inotify.sh [1] 37968 [rootcode java]# bash: /usr/local/inotify.sh: 没有那个文件或目录 ^C [1] 退出 127 /usr/local/inotify.sh [rootcode java]# /usr/local/bin/inotify.sh [1] 37984 [rootcode java]# chmod x /usr/local/bin/inotify.sh [2] 38016 [rootcode java]# jobs [1]- 运行中 /usr/local/bin/inotify.sh [2] 完成 chmod x /usr/local/bin/inotify.sh [rootcode java]# vim /usr/local/bin/inotify.sh[rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash export TZAsia/Shanghai /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode java]# touch /root/java/testfile touch: 无法创建/root/java/testfile: 没有那个文件或目录 [rootcode java]# touch /root/app/java/testfile [rootcode java]# sending incremental file list ./ testfilesent 472 bytes received 48 bytes 346.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 426 bytes received 22 bytes 896.00 bytes/sec total size is 0 speedup is 0.00 ^C [rootcode java]# jobs [1] 运行中 /usr/local/bin/inotify.sh [rootcode java]# tail -n 5 /var/log/rsync.log date%F\ %T fasheng/root/app/java/ ATTRIB aa5 date%F\ %T fasheng/root/app/java/ DELETE 68.java date%F\ %T fasheng/root/app/java/ DELETE 69.java 2025-05-24 19:42:29 fasheng/root/app/java/ CREATE testfile 2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile 可以了 问题1不显示时间解决了推测是格式问题 [rootcode bin]# vim /usr/local/bin/inotify.sh [rootcode bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode bin]# pkill -f inotify.sh [1] 已终止 nohup ./inotify.sh [rootcode bin]# nohup ./inotify.sh [1] 42179 [rootcode bin]# nohup: 忽略输入并把输出追加到nohup.out jobs [1] 运行中 nohup ./inotify.sh [rootcode bin]# touch /root/app/java/testfile8.java [rootcode bin]# tail -5 /var/log/rsync.log 2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2 2025-05-24 20:03:44 fasheng/root/app/java/ CREATE testfile4.java 2025-05-24 20:03:45 fasheng/root/app/java/ ATTRIB testfile4.java 2025-05-24 20:24:51 fasheng/root/app/java/ CREATE testfile8.java 2025-05-24 20:24:51 fasheng/root/app/java/ ATTRIB testfile8.java 格式问题 推测端口问题也应该要先杀死进程 再重新启动 [rootcode app]# cd java bash: cd: java: 不是目录 [rootcode app]# mkdir /java [rootcode app]# ;s bash: 未预期的符号 ; 附近有语法错误 [rootcode app]# ls java [rootcode app]# cd java bash: cd: java: 不是目录 [rootcode app]# mkdir /java mkdir: 无法创建目录/java: 文件已存在 [rootcode app]# ls java [rootcode app]# cd java bash: cd: java: 不是目录 [rootcode bin]# rm -rf /root/app/java testfile2 [rootcode bin]# tail -5 /var/log/rsync.log 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED [rootcode bin]# ls /root/app/java ls: 无法访问/root/app/java: 没有那个文件或目录 [rootcode bin]# cd /root/app/java [rootcode app]# cd ./java [rootcode java]# touch {1..4}.java [rootcode java]# ls 1.java 2.java 3.java 4.java [rootcode java]# tail -5 /var/log/rsync.log 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED [rootcode java]# jobs [1] 运行中 nohup ./inotify.sh (工作目录/usr/local/bin) [rootcode java]# tail -5 /usr/local/bin/nohup.out rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] a: [rootcode java]# touch 5.java [rootcode java]# tail -5 /var/log/rsync.log\^C [rootcode java]# [rootcode java]# tail -5 /var/log/rsync.log 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED 2025-05-24 21:11:50 fasheng/root/app/java/ CREATE 5.java 2025-05-24 21:11:50 fasheng/root/app/java/ ATTRIB 5.java [rootcode java]# tail -5 /usr/local/bin/nohup.out total size is 0 speedup is 0.00 sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec total size is 0 speedup is 0.00 [rootcode java]# tail -10 /usr/local/bin/nohup.out sending incremental file list ./ 5.javasent 187 bytes received 38 bytes 150.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec total size is 0 speedup is 0.00 b 复制粘贴到外部环境又失效了b 虚拟机内粘贴了也不行 出来还是粘贴的a的代码 又好了 b 测试成功 若改变shell内容指定端口 需先断开 再连接 源码 节点a: [caozx26code dir1]$ date 2025年 05月 24日 星期六 13:18:31 CST [caozx26code dir1]$ route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.235.254 0.0.0.0 UG 0 0 0 ens33 169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 ens33 192.168.235.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33 [caozx26code dir1]$ ip a 1: lo: LOOPBACK,UP,LOWER_UP mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:d6:84:b3 brd ff:ff:ff:ff:ff:ffinet 192.168.235.10/24 brd 192.168.235.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fed6:84b3/64 scope link valid_lft forever preferred_lft forever 3: virbr0: BROADCAST,MULTICAST mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:d1:59:30 brd ff:ff:ff:ff:ff:ff 4: virbr0-nic: BROADCAST,MULTICAST mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:d1:59:30 brd ff:ff:ff:ff:ff:ff [caozx26code dir1]$ ping 192.168.235.100 PING 192.168.235.100 (192.168.235.100) 56(84) bytes of data. 64 bytes from 192.168.235.100: icmp_seq1 ttl64 time1.50 ms 64 bytes from 192.168.235.100: icmp_seq2 ttl64 time2.64 ms 64 bytes from 192.168.235.100: icmp_seq3 ttl64 time2.84 ms ^C --- 192.168.235.100 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2007ms rtt min/avg/max/mdev 1.502/2.330/2.843/0.592 ms [caozx26code dir1]$ ssh root192.168.235.100 The authenticity of host 192.168.235.100 (192.168.235.100) cant be established. ECDSA key fingerprint is SHA256:PbCAj5CjyP8yLyHMKdEPFFA4planWCr8FpxrrOp3dI. ECDSA key fingerprint is MD5:5b:0a:38:81:36:32:b6:38:d1:d8:3b:61:12:39:5a:fc. Are you sure you want to continue connecting (yes/no)? y Please type yes or no: y Please type yes or no: yes Warning: Permanently added 192.168.235.100 (ECDSA) to the list of known hosts. root192.168.235.100s password: Permission denied, please try again. root192.168.235.100s password: Last failed login: Sat May 24 13:21:23 CST 2025 from 192.168.235.10 on ssh:notty There was 1 failed login attempt since the last successful login. Last login: Sat May 24 13:19:55 2025 [rootbackup ~]# exit 登出 Connection to 192.168.235.100 closed. [caozx26code dir1]$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/caozx26/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/caozx26/.ssh/id_rsa. Your public key has been saved in /home/caozx26/.ssh/id_rsa.pub. The key fingerprint is: SHA256:/s621fa7t7h6fwi9z13I6Uo0jasH0ZlebLNJcpeDCI caozx26code.itcast.cn The keys randomart image is: ---[RSA 2048]---- | | | . | | E . * o . | | . X o | | S. | | .. . .. . | | o .o * | | ..Ooo.*| | .BooO/| ----[SHA256]----- [caozx26code dir1]$ ssh-copy-id root192.168.235.100 /bin/ssh-copy-id: INFO: Source of key(s) to be installed: /home/caozx26/.ssh/id_rsa.pub /bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed /bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys root192.168.235.100s password: Number of key(s) added: 1Now try logging into the machine, with: ssh root192.168.235.100 and check to make sure that only the key(s) you wanted were added.[caozx26code dir1]$ ssh root192.168.235.100 Last login: Sat May 24 13:21:28 2025 from 192.168.235.10 [rootbackup ~]# exit 登出 Connection to 192.168.235.100 closed. [caozx26code dir1]$ //mian mi denglu chenggong,jihua pei rsync jiankong -bash: //mian: 没有那个文件或目录 [caozx26code dir1]$ cd [caozx26code ~]$ ls 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ ld / /: 文件无法辨识: 是一个目录 [caozx26code ~]$ ls / app boot dir1 dir12 dir2 etc lib media opt root sbin srv tmp var bin dev dir11 dir13 dir3 home lib64 mnt proc run shop sys usr [caozx26code ~]$ cd /app [caozx26code app]$ ls java_project [caozx26code app]$ cd /usr/local [caozx26code local]$ ls bin etc games include inotify-tools-3.13 lib lib64 libexec sbin share src [caozx26code local]$ cd bin [caozx26code bin]$ ls inotifywait inotifywatch [caozx26code bin]$ 2.bianxie bash bash: 2.bianxie: 未找到命令... [caozx26code bin]$ 2.bianxie shell bash: 2.bianxie: 未找到命令... [caozx26code bin]$ huibuhui shi meizhaodao mulu bash: huibuhui: 未找到命令... [caozx26code bin]$ cd / [caozx26code /]$ ls app boot dir1 dir12 dir2 etc lib media opt root sbin srv tmp var bin dev dir11 dir13 dir3 home lib64 mnt proc run shop sys usr [caozx26code /]$ vim inotify.sh [caozx26code /]$ dao di shiyong root yonghu haishi yong qita honghu ,qi ru zai shiji huanjing zhong ,bukeneng douyong root yonghu ba bash: dao: 未找到命令... [caozx26code /]$ xian ce yi xia rsync bash: xian: 未找到命令... [caozx26code /]$ ll app 总用量 0 drwxr-xr-x. 5 root root 215 5月 15 21:30 java_project [caozx26code /]$ cd /app/java_project [caozx26code java_project]$ ls 2.java aa2 file1.java file3.java file5.java file7.java file9.java aa1 aa3 file2.java file4.java file6.java file8.java [caozx26code java_project]$ touch {10..13}.java touch: 无法创建10.java: 权限不够 touch: 无法创建11.java: 权限不够 touch: 无法创建12.java: 权限不够 touch: 无法创建13.java: 权限不够 [caozx26code java_project]$ mkdir -p /home/caozx26/app/java [caozx26code java_project]$ cd /home/caozx26 [caozx26code ~]$ cd app [caozx26code app]$ ls java [caozx26code app]$ cd java [caozx26code java]$ cai xiang zai shiji shengchanzhong ,yige yonghu yige zhanghao ,huo tongyi zhanghao ,xiangguan daima wenjianjia peizhihao quanxian bash: cai: 未找到命令... [caozx26code java]$ touch {1..6}.java [caozx26code java]$ ls 1.java 2.java 3.java 4.java 5.java 6.java [caozx26code java]$ rsync /home/caozx26/app/java/ root192.168.235.100:/backup/app1_java skipping directory . [caozx26code java]$ rsync -av /home/caozx26/app/java root192.168.235.100:/backup/app1_java sending incremental file list java/ java/1.java java/2.java java/3.java java/4.java java/5.java java/6.javasent 423 bytes received 134 bytes 371.33 bytes/sec total size is 0 speedup is 0.00 [caozx26code java]$ ls 1.java 2.java 3.java 4.java 5.java 6.java [caozx26code java]$ rsync -av /home/caozx26/app/java/ root192.168.235.100:/backup/app1_java sending incremental file list ./ 1.java 2.java 3.java 4.java 5.java 6.javasent 405 bytes received 15,211 bytes 10,410.67 bytes/sec total size is 0 speedup is 0.00 [caozx26code java]$ rsync -av --delete /home/caozx26/app/java/ root192.168.235.100:/backup/app1_java sending incremental file list deleting java/6.java deleting java/5.java deleting java/4.java deleting java/3.java deleting java/2.java deleting java/1.java deleting java/ deleting aa3/ deleting aa2/ deleting aa1/ deleting file9.java deleting file8.java deleting file7.java deleting file6.java deleting file5.java deleting file4.java deleting file3.java deleting file2.java deleting file1.javasent 168 bytes received 261 bytes 286.00 bytes/sec total size is 0 speedup is 0.00 [caozx26code java]$ cd /home/code -bash: cd: /home/code: 权限不够 [caozx26code java]$ cd /home/caozx26 [caozx26code ~]$ ls app 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ ll -d /etc drwxr-xr-x. 145 root root 8192 5月 24 13:17 /etc [caozx26code ~]$ ls app 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ cd /home/caozx26 [caozx26code ~]$ ls app 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ hostname code.itcast.cn [caozx26code ~]$ ls app 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ cd app [caozx26code app]$ ls java [caozx26code app]$ ll -d /usr drwxr-xr-x. 13 root root 155 4月 17 05:01 /usr [caozx26code app]$ cd ~ [caozx26code ~]$ ls app 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ vim inotify.sh [caozx26code ~]$ cat inotify.sh /usr/lcoal/bin/inotifywait -mrq -e create,modify,move,delete,attrib /home/caozx26 [caozx26code ~]$ cd /usr/local/bin [caozx26code bin]$ cd inotifywait -bash: cd: inotifywait: 不是目录 [caozx26code bin]$ ls inotifywait inotifywatch [caozx26code bin]$ inotifywait -mrq -e create,modify,move,delete,attrib /home/caozx26/app/java ^C [caozx26code bin]$ cd /home/caox26/ -bash: cd: /home/caox26/: 没有那个文件或目录 [caozx26code bin]$ cd /home [caozx26code home]$ cd caozx26 [caozx26code ~]$ cd - /home [caozx26code home]$ cd - /home/caozx26 [caozx26code ~]$ ls app inotify.sh 公共 模板 视频 图片 文档 下载 音乐 桌面 [caozx26code ~]$ vim inotify.sh [caozx26code ~]$ chmod X inotify.sh [caozx26code ~]$ cat inotify.sh /usr/lcoal/bin/inotifywait -mrq -e create,modify,move,delete,attrib /home/caozx26/app/java |while read events dorsync -av /home/caozx26/app/java/ root192.168.235.100:/backup/app1_javadone [caozx26code ~]$ 节点b [backupbackup ~]$ date 2025年 05月 24日 星期六 13:18:24 CST [backupbackup ~]$ ip a 1: lo: LOOPBACK,UP,LOWER_UP mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:04:f5:98 brd ff:ff:ff:ff:ff:ffinet 192.168.235.100/24 brd 192.168.235.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe04:f598/64 scope link valid_lft forever preferred_lft forever 3: virbr0: BROADCAST,MULTICAST mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:53:dd:1d brd ff:ff:ff:ff:ff:ff 4: virbr0-nic: BROADCAST,MULTICAST mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:53:dd:1d brd ff:ff:ff:ff:ff:ff [backupbackup ~]$ cd /etc/sshd -bash: cd: /etc/sshd: 没有那个文件或目录 [backupbackup ~]$ cd /etc/ssh [backupbackup ssh]$ cat sshd_config cat: sshd_config: 权限不够 [backupbackup ssh]$ su - caozx26 密码 上一次登录六 5月 17 17:37:50 CST 2025pts/2 上 [caozx26backup ~]$ sudo su [sudo] caozx26 的密码 [rootbackup caozx26]# cat sshd_config cat: sshd_config: 没有那个文件或目录 [rootbackup caozx26]# cat /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See # sshd_config(5) for more information.# This sshd was compiled with PATH/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value.# If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # #Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying #RekeyLimit default none# Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO# Authentication:#LoginGraceTime 2m #PermitRootLogin yes #StrictModes yes #MaxAuthTries 6 #MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you dont trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Dont read the users ~/.rhosts and ~/.shosts files #IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication yes# Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no# Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes# GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no# Set this to yes to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of PermitRootLogin without-password. # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to no. # WARNING: UsePAM no is not supported in Red Hat Enterprise Linux and may cause several # problems. UsePAM yes#AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #UsePrivilegeSeparation sandbox #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none# no default banner path #Banner none# Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS# override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server [rootbackup caozx26]# ls 公共 模板 视频 图片 文档 下载 音乐 桌面 [rootbackup caozx26]# ls backup ls: 无法访问backup: 没有那个文件或目录 [rootbackup caozx26]# cd /root/backup bash: cd: /root/backup: 没有那个文件或目录 [rootbackup caozx26]# ls / 2010 bin dev home lib64 mnt proc run srv tmp var backup boot etc lib media opt root sbin sys usr [rootbackup caozx26]# cd /backup [rootbackup backup]# ls app1_java [rootbackup backup]# cd app1_java [rootbackup app1_java]# ls 2.java aa2 file1.java file3.java file5.java file7.java file9.java aa1 aa3 file2.java file4.java file6.java file8.java [rootbackup app1_java]# ls 2.java aa2 file1.java file3.java file5.java file7.java file9.java aa1 aa3 file2.java file4.java file6.java file8.java java [rootbackup app1_java]# ls 1.java 3.java 5.java aa1 aa3 file2.java file4.java file6.java file8.java java 2.java 4.java 6.java aa2 file1.java file3.java file5.java file7.java file9.java [rootbackup app1_java]# ls 1.java 2.java 3.java 4.java 5.java 6.java [rootbackup app1_java]# a: p6P [rootlocalhost bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -e /usr/bin/ssh -p 3712 -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F\ %T) fasheng$events /var/log/rsync.log 21 done 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# cd /root/app/java [rootlocalhost java]# ls 35.txt 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 66.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java]# rm -rf 35.txt [rootlocalhost java]# ks bash: ks: 未找到命令... [rootlocalhost java]# ls 66.java 69.java aa3 file20.java file23.java file4.java file7.java 67.java aa1 file19.java file21.java file2.java file5.java 68.java aa2 file1.java file22.java file3.java file6.java [rootlocalhost java]# cat /var/log/reync.log cat: /var/log/reync.log: 没有那个文件或目录 [rootlocalhost java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# cd /usr/local/bin 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ls inotify.sh inotifywait inotifywatch nohup.out [rootlocalhost bin]# cat nohup.out ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ./inotify.sh:行4: 未预期的符号 ( 附近有语法错误 ./inotify.sh:行4: rsync -e(ssh -p 3712) -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] [rootlocalhost bin]# rsync -av /root/app/java/ code192.168.235.100:/home/code/backup/java_backup ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ssh code192.168.235.100 ssh: connect to host 192.168.235.100 port 22: Connection refused 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ssh code192.168.235.100 ssh: connect to host 192.168.235.100 port 22: Connection refused 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ssh code192.168.235.100 ssh: connect to host 192.168.235.100 port 22: Connection refused 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ssh code192.168.235.100 ssh: connect to host 192.168.235.100 port 22: Connection refused [rootlocalhost bin]# ping 192.168.235.100 PING 192.168.235.100 (192.168.235.100) 56(84) bytes of data. 64 bytes from 192.168.235.100: icmp_seq1 ttl64 time0.323 ms 64 bytes from 192.168.235.100: icmp_seq2 ttl64 time0.423 ms ^C --- 192.168.235.100 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1000ms rtt min/avg/max/mdev 0.323/0.373/0.423/0.050 ms 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ip a 1: lo: LOOPBACK,UP,LOWER_UP mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:97:84:5e brd ff:ff:ff:ff:ff:ffinet 192.168.235.20/24 brd 192.168.235.255 scope global ens33valid_lft forever preferred_lft foreverinet6 fe80::20c:29ff:fe97:845e/64 scope link valid_lft forever preferred_lft forever 3: virbr0: BROADCAST,MULTICAST mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:2a:35:da brd ff:ff:ff:ff:ff:ff 4: virbr0-nic: BROADCAST,MULTICAST mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:2a:35:da brd ff:ff:ff:ff:ff:ff 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ssh code192.168.235.100 Last login: Sat May 24 15:53:31 2025 from 192.168.235.20 [codecode ~]$ rsync /root/app/java code192.168.235.20:/home/code/backup/java_backup The authenticity of host 192.168.235.20 (192.168.235.20) cant be established. ECDSA key fingerprint is SHA256:RBwUidqa/j7LBfrU3DT4o2bFpnk0zYaWnLFebYwM8I. ECDSA key fingerprint is MD5:0b:79:2e:7e:10:00:a6:07:74:f8:66:ee:3e:11:61:c8. Are you sure you want to continue connecting (yes/no)? ^Crsync error: received SIGINT, SIGTERM, or SIGHUP (code 20) at rsync.c(638) [sender3.1.2] [codecode ~]$ rsync -av /root/app/java code192.168.235.100:/home/code/backup/java_backup The authenticity of host 192.168.235.100 (192.168.235.100) cant be established. ECDSA key fingerprint is SHA256:8RG4GdpTOwlDCCFt0rsKQV5kuZ3v4pWCO/z9qTTqhw. ECDSA key fingerprint is MD5:e4:f1:b2:d5:1d:87:e6:2a:6a:0d:ef:27:4f:16:8b:df. Are you sure you want to continue connecting (yes/no)? y Please type yes or no: yes Warning: Permanently added 192.168.235.100 (ECDSA) to the list of known hosts. code192.168.235.100s password: sending incremental file list rsync: change_dir /root/app failed: Permission denied (13)sent 20 bytes received 12 bytes 1.49 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] [codecode ~]$ ^C [codecode ~]$ exit 登出 Connection to 192.168.235.100 closed. 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# rsync -av /root/app/java code192.168.235.100:/home/code/bakcup/java_backup sending incremental file list rsync: mkdir /home/code/bakcup/java_backup failed: No such file or directory (2) rsync error: error in file IO (code 11) at main.c(657) [Receiver3.1.2] 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# rsync -av /root/app/java/ code192.168.235.100:/home/code/backup/java_backup sending incremental file list ./sent 451 bytes received 29 bytes 960.00 bytes/sec total size is 0 speedup is 0.00 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# vim /usr/local/bin/rsync.sh [rootlocalhost bin]# vim /usr/local/bin/inotify.sh 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F\ %T) fasheng$events /var/log/rsync.log 21 done [rootlocalhost bin]# cd /root/app/java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# ls 66.java 69.java aa3 file20.java file23.java file4.java file7.java 67.java aa1 file19.java file21.java file2.java file5.java 68.java aa2 file1.java file22.java file3.java file6.java [rootlocalhost java]# rm -rf 66.java [rootlocalhost java]# ls 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java [rootlocalhost java]# ls 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# rm -rf 67.java [rootlocalhost java]# ls 68.java aa2 file1.java file22.java file3.java file6.java 69.java aa3 file20.java file23.java file4.java file7.java aa1 file19.java file21.java file2.java file5.java [rootlocalhost java]# cd /usr/local/bin 您在 /var/spool/mail/root 中有邮件 [rootlocalhost bin]# ls inotify.sh inotifywait inotifywatch nohup.out [rootlocalhost bin]# cat nohup.out ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ./inotify.sh:行4: 未预期的符号 ( 附近有语法错误 ./inotify.sh:行4: rsync -e(ssh -p 3712) -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] sending incremental file list deleting 66.java deleting 35.txt ./sent 437 bytes received 50 bytes 324.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file list deleting 67.java ./sent 418 bytes received 40 bytes 916.00 bytes/sec total size is 0 speedup is 0.00 [rootlocalhost bin]# cd /root/app/java 您在 /var/spool/mail/root 中有邮件 [rootlocalhost java]# ls 68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java]# touch aa{4..5} [rootlocalhost java]# ls 68.java 69.java aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java]# 登出 [caozx26localhost /]$ cd - /shop [caozx26localhost shop]$ cd - / [caozx26localhost /]$ sudo su [sudo] caozx26 的密码 [rootcode /]# cd - bash: cd: OLDPWD 未设定 [rootcode /]# cat /usr/bin/local/nohup.out cat: /usr/bin/local/nohup.out: 没有那个文件或目录 [rootcode /]# cat /usr/local/bin/nohup.out ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ./inotify.sh:行4: 未预期的符号 ( 附近有语法错误 ./inotify.sh:行4: rsync -e(ssh -p 3712) -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] sending incremental file list deleting 66.java deleting 35.txt ./sent 437 bytes received 50 bytes 324.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file list deleting 67.java ./sent 418 bytes received 40 bytes 916.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list ./ aa4 aa5sent 528 bytes received 67 bytes 396.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 310.00 bytes/sec total size is 0 speedup is 0.00 [rootcode /]# cd /usr/local/bin [rootcode bin]# ls inotify.sh inotifywait inotifywatch nohup.out [rootcode bin]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java date%F\ %T fasheng/root/app/java/ DELETE 67.java date%F\ %T fasheng/root/app/java/ CREATE aa4 date%F\ %T fasheng/root/app/java/ ATTRIB aa4 date%F\ %T fasheng/root/app/java/ CREATE aa5 date%F\ %T fasheng/root/app/java/ ATTRIB aa5 [rootcode bin]# vim inotify.sh [rootcode bin]# cat inotift.sh cat: inotift.sh: 没有那个文件或目录 [rootcode bin]# cat inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo date %F\ %T fasheng$events /var/log/rsync.log 21 done [rootcode bin]# cd /root/app/java [rootcode java]# ls 68.java 69.java aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootcode java]# rm -rf 68.java [rootcode java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java date%F\ %T fasheng/root/app/java/ DELETE 67.java date%F\ %T fasheng/root/app/java/ CREATE aa4 date%F\ %T fasheng/root/app/java/ ATTRIB aa4 date%F\ %T fasheng/root/app/java/ CREATE aa5 date%F\ %T fasheng/root/app/java/ ATTRIB aa5 date%F\ %T fasheng/root/app/java/ DELETE 68.java [rootcode java]# cat /usr/local/bin/inotfy.sh cat: /usr/local/bin/inotfy.sh: 没有那个文件或目录 [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo date %F\ %T fasheng$events /var/log/rsync.log 21 done [rootcode java]# vim /usr/local/bin/inotify.sh [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode java]# ls 69.java aa2 aa4 file19.java file20.java file22.java file2.java file4.java file6.java aa1 aa3 aa5 file1.java file21.java file23.java file3.java file5.java file7.java [rootcode java]# rm -rf 69.java [rootcode java]# cat /var/log/rsync.log 2025/05/20 19:55:49 [39497] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 19:57:15 [39652] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 20:04:57 [40396] rsync: chroot /~/app/java failed: No such file or directory (2) 2025/05/20 13:14:43 [44477] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:14:43 [44477] building file list 2025/05/20 13:14:43 [44477] sent 318 bytes received 72 bytes total size 0 2025/05/20 13:40:01 [46901] rsync on app/ from UNKNOWN (192.168.235.100) 2025/05/20 13:40:01 [46901] building file list 2025/05/20 13:40:01 [46901] sent 6293634 bytes received 156 bytes total size 6291456 2025/05/21 12:50:38 [61037] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:50:38 [61037] building file list 2025/05/21 12:50:38 [61037] sent 6293664 bytes received 190 bytes total size 6291456 2025/05/21 12:57:38 [61741] rsync on app/ from boss1UNKNOWN (192.168.235.100) 2025/05/21 12:57:38 [61741] building file list 2025/05/21 12:57:38 [61741] sent 405 bytes received 35 bytes total size 6291456 date%F\ %T fasheng/root/app/java/ CREATE 321.java date%F\ %T fasheng/root/app/java/ MODIFY 321.java date%F\ %T fasheng/root/app/java/ CREATE 21.java date%F\ %T fasheng/root/app/java/ ATTRIB 21.java date%F\ %T fasheng/root/app/java/ CREATE 34.txt date%F\ %T fasheng/root/app/java/ ATTRIB 34.txt date%F\ %T fasheng/root/app/java/ CREATE 322.java date%F\ %T fasheng/root/app/java/ MODIFY 322.java date%F\ %T fasheng/root/app/java/ CREATE 333.java date%F\ %T fasheng/root/app/java/ MODIFY 333.java date%F\ %T fasheng/root/app/java/ CREATE 66.java date%F\ %T fasheng/root/app/java/ ATTRIB 66.java date%F\ %T fasheng/root/app/java/ CREATE 67.java date%F\ %T fasheng/root/app/java/ ATTRIB 67.java date%F\ %T fasheng/root/app/java/ CREATE 68.java date%F\ %T fasheng/root/app/java/ ATTRIB 68.java date%F\ %T fasheng/root/app/java/ CREATE 69.java date%F\ %T fasheng/root/app/java/ ATTRIB 69.java date%F\ %T fasheng/root/app/java/ DELETE 21.java date%F\ %T fasheng/root/app/java/ DELETE 321.java date%F\ %T fasheng/root/app/java/ DELETE 322.java date%F\ %T fasheng/root/app/java/ DELETE 333.java date%F\ %T fasheng/root/app/java/ DELETE 34.txt date%F\ %T fasheng/root/app/java/ DELETE 35.txt date%F\ %T fasheng/root/app/java/ DELETE 66.java date%F\ %T fasheng/root/app/java/ DELETE 67.java date%F\ %T fasheng/root/app/java/ CREATE aa4 date%F\ %T fasheng/root/app/java/ ATTRIB aa4 date%F\ %T fasheng/root/app/java/ CREATE aa5 date%F\ %T fasheng/root/app/java/ ATTRIB aa5 date%F\ %T fasheng/root/app/java/ DELETE 68.java date%F\ %T fasheng/root/app/java/ DELETE 69.java [rootcode java]# ls -l /etc/localtime lrwxrwxrwx. 1 root root 35 4月 19 17:20 /etc/localtime - ../usr/share/zoneinfo/Asia/Shanghai [rootcode java]# /usr/local/bin/inotify.java bash: /usr/local/bin/inotify.java: 没有那个文件或目录 [rootcode java]# /usr/local/bin/inotify.sh jobs ^C [rootcode java]# vim /usr/local/bin/inotify.sh [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode java]# pkill -f inotify.sh [rootcode java]# /usr/local/bin/inotify/sh [1] 37918 [rootcode java]# bash: /usr/local/bin/inotify/sh: 没有那个文件或目录 ^C [1] 退出 127 /usr/local/bin/inotify/sh [rootcode java]# /usr/local/inotify.sh [1] 37968 [rootcode java]# bash: /usr/local/inotify.sh: 没有那个文件或目录 ^C [1] 退出 127 /usr/local/inotify.sh [rootcode java]# /usr/local/bin/inotify.sh [1] 37984 [rootcode java]# chmod x /usr/local/bin/inotify.sh [2] 38016 [rootcode java]# jobs [1]- 运行中 /usr/local/bin/inotify.sh [2] 完成 chmod x /usr/local/bin/inotify.sh [rootcode java]# vim /usr/local/bin/inotify.sh [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash export TZAsia/Shanghai /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode java]# touch /root/java/testfile touch: 无法创建/root/java/testfile: 没有那个文件或目录 [rootcode java]# touch /root/app/java/testfile [rootcode java]# sending incremental file list ./ testfilesent 472 bytes received 48 bytes 346.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 426 bytes received 22 bytes 896.00 bytes/sec total size is 0 speedup is 0.00 ^C [rootcode java]# jobs [1] 运行中 /usr/local/bin/inotify.sh [rootcode java]# tail -n 5 /var/log/rsync.log date%F\ %T fasheng/root/app/java/ ATTRIB aa5 date%F\ %T fasheng/root/app/java/ DELETE 68.java date%F\ %T fasheng/root/app/java/ DELETE 69.java 2025-05-24 19:42:29 fasheng/root/app/java/ CREATE testfile 2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile [rootcode java]# touch /root/java/testfile2 touch: 无法创建/root/java/testfile2: 没有那个文件或目录 [rootcode java]# touch /root/app/java/testfile2 [rootcode java]# sending incremental file list ./ testfile2sent 489 bytes received 48 bytes 1,074.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec total size is 0 speedup is 0.00 ^C [rootcode java]# tail -5 /var/log/rsync.log date%F\ %T fasheng/root/app/java/ DELETE 69.java 2025-05-24 19:42:29 fasheng/root/app/java/ CREATE testfile 2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile 2025-05-24 19:43:47 fasheng/root/app/java/ CREATE testfile2 2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2 [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash export TZAsia/Shanghai /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode java]# pkill -f inotify.sh [1] 已终止 /usr/local/bin/inotify.sh [rootcode java]# nohup ./inotify.sh [1] 38600 [rootcode java]# nohup: 忽略输入并把输出追加到nohup.out nohup: 无法运行命令./inotify.sh: 没有那个文件或目录 ^C [1] 退出 127 nohup ./inotify.sh [rootcode java]# cd /usr/local/bin [rootcode bin]# ls inotify.sh inotifywait inotifywatch nohup.out [rootcode bin]# jobs [rootcode bin]# nohup ./inotify.sh [1] 39922 [rootcode bin]# nohup: 忽略输入并把输出追加到nohup.out jpnd bash: jpnd: 未找到命令... [rootcode bin]# jobd bash: jobd: 未找到命令... [rootcode bin]# jobs [1] 运行中 nohup ./inotify.sh [rootcode bin]# touch /root/app/java/testfile4.java [rootcode bin]# tail -5 /var/log/rsync.log 2025-05-24 19:42:29 fasheng/root/app/java/ ATTRIB testfile 2025-05-24 19:43:47 fasheng/root/app/java/ CREATE testfile2 2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2 2025-05-24 20:03:44 fasheng/root/app/java/ CREATE testfile4.java 2025-05-24 20:03:45 fasheng/root/app/java/ ATTRIB testfile4.java [rootcode bin]# vim /usr/local/bin/inotify.sh [rootcode bin]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode bin]# pkill -f inotify.sh [1] 已终止 nohup ./inotify.sh [rootcode bin]# nohup ./inotify.sh [1] 42179 [rootcode bin]# nohup: 忽略输入并把输出追加到nohup.out jobs [1] 运行中 nohup ./inotify.sh [rootcode bin]# touch /root/app/java/testfile8.java [rootcode bin]# tail -5 /var/log/rsync.log 2025-05-24 19:43:47 fasheng/root/app/java/ ATTRIB testfile2 2025-05-24 20:03:44 fasheng/root/app/java/ CREATE testfile4.java 2025-05-24 20:03:45 fasheng/root/app/java/ ATTRIB testfile4.java 2025-05-24 20:24:51 fasheng/root/app/java/ CREATE testfile8.java 2025-05-24 20:24:51 fasheng/root/app/java/ ATTRIB testfile8.java [rootcode bin]# rm -rf /root/app/java testfile2 [rootcode bin]# tail -5 /var/log/rsync.log 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED [rootcode bin]# ls /root/app/java ls: 无法访问/root/app/java: 没有那个文件或目录 [rootcode bin]# cd /root/app/java bash: cd: /root/app/java: 没有那个文件或目录 [rootcode bin]# cd /root/app [rootcode app]# ;s bash: 未预期的符号 ; 附近有语法错误 [rootcode app]# ls [rootcode app]# ls [rootcode app]# touch java [rootcode app]# ls java [rootcode app]# cd java bash: cd: java: 不是目录 [rootcode app]# mkdir /java [rootcode app]# ;s bash: 未预期的符号 ; 附近有语法错误 [rootcode app]# ls java [rootcode app]# cd java bash: cd: java: 不是目录 [rootcode app]# mkdir /java mkdir: 无法创建目录/java: 文件已存在 [rootcode app]# ls java [rootcode app]# cd java bash: cd: java: 不是目录 [rootcode app]# rm rf java rm: 无法删除rf: 没有那个文件或目录 rm是否删除普通空文件 javay [rootcode app]# ls [rootcode app]# mkdir ./java [rootcode app]# ls java [rootcode app]# touch ./java {1..4}.java [rootcode app]# cd java [rootcode java]# ls [rootcode java]# cd - /root/app [rootcode app]# ls 1.java 2.java 3.java 4.java java [rootcode app]# touch -p ./java {1..4}.java touch无效选项 -- p Try touch --help for more information. [rootcode app]# cd ./java [rootcode java]# touch {1..4}.java [rootcode java]# ls 1.java 2.java 3.java 4.java [rootcode java]# tail -5 /var/log/rsync.log 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED [rootcode java]# jobs [1] 运行中 nohup ./inotify.sh (工作目录/usr/local/bin) [rootcode java]# tail -10 /usr/local/bin/nohup.outsent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] [rootcode java]# tail -20 /usr/local/bin/nohup.out total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] [rootcode java]# kill -f inotify.sh bash: kill: f: 无效的信号声明 [rootcode java]# pkill -f inotify.sh [1] 已终止 nohup ./inotify.sh(工作目录/usr/local/bin) (当前工作目录~/app/java) [rootcode java]# cd /usr/local/bin/ [rootcode bin]# nohup ./inotify.sh [1] 44327 [rootcode bin]# nohup: 忽略输入并把输出追加到nohup.out jobs [1] 运行中 nohup ./inotify.sh [rootcode bin]# tail -6 /var/log/rsync.log 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED [rootcode bin]# cd /root/app/java [rootcode java]# ls 1.java 2.java 3.java 4.java [rootcode java]# cat /usr/local/bin/nohup.out ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ./inotify.sh:行4: 未预期的符号 ( 附近有语法错误 ./inotify.sh:行4: rsync -e(ssh -p 3712) -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] ssh: connect to host 192.168.235.100 port 22: Connection refused rsync: connection unexpectedly closed (0 bytes received so far) [sender] rsync error: unexplained error (code 255) at io.c(226) [sender3.1.2] sending incremental file list deleting 66.java deleting 35.txt ./sent 437 bytes received 50 bytes 324.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file list deleting 67.java ./sent 418 bytes received 40 bytes 916.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list ./ aa4 aa5sent 528 bytes received 67 bytes 396.67 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 930.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 443 bytes received 22 bytes 310.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list deleting 68.java ./sent 427 bytes received 36 bytes 926.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list deleting 69.java ./sent 410 bytes received 40 bytes 300.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list ./ nohup.out testfile4.javasent 588 bytes received 67 bytes 1,310.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 503 bytes received 22 bytes 350.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list ./ testfile8.javasent 571 bytes received 48 bytes 1,238.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 525 bytes received 22 bytes 1,094.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 24.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] sending incremental file list rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] [rootcode java]# tail -5 /usr/local/bin/nohup.out rsync: change_dir /root/app/java failed: No such file or directory (2)sent 24 bytes received 12 bytes 72.00 bytes/sec total size is 0 speedup is 0.00 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender3.1.2] [rootcode java]# rsync -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup sending incremental file list deleting file7.java/ deleting file6.java/ deleting file5.java/ deleting file4.java/ deleting file3.java/ deleting file2.java/ deleting file1.java/ deleting aa3/ deleting aa2/ deleting aa1/ deleting testfile8.java deleting testfile4.java deleting testfile2 deleting testfile deleting nohup.out deleting file23.java deleting file22.java deleting file21.java deleting file20.java deleting file19.java deleting aa5 deleting aa4 ./ 1.java 2.java 3.java 4.javasent 279 bytes received 387 bytes 1,332.00 bytes/sec total size is 0 speedup is 0.00 [rootcode java]# tail -5 /var/log/rsync.log 2025-05-24 20:26:25 fasheng/root/app/java/ DELETE testfile2 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE nohup.out 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED [rootcode java]# ls 1.java 2.java 3.java 4.java [rootcode java]# touch 5.java [rootcode java]# tail -5 /var/log/rsync.log\^C [rootcode java]# [rootcode java]# tail -5 /var/log/rsync.log 2025-05-24 20:26:26 fasheng/root/app/java/ DELETE testfile4.java 2025-05-24 20:26:27 fasheng/root/app/java/ DELETE testfile8.java 2025-05-24 20:26:27 fasheng/root/app/java/ IGNORED 2025-05-24 21:11:50 fasheng/root/app/java/ CREATE 5.java 2025-05-24 21:11:50 fasheng/root/app/java/ ATTRIB 5.java [rootcode java]# tail -5 /usr/local/bin/nohup.out total size is 0 speedup is 0.00 sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec total size is 0 speedup is 0.00 [rootcode java]# tail -10 /usr/local/bin/nohup.out sending incremental file list ./ 5.javasent 187 bytes received 38 bytes 150.00 bytes/sec total size is 0 speedup is 0.00 sending incremental file listsent 141 bytes received 12 bytes 306.00 bytes/sec total size is 0 speedup is 0.00 [rootcode java]# ssh -p 3333 code192.168.235.100 Last login: Sat May 24 18:38:16 2025 from 192.168.235.20 [codecode ~]$ exit 登出 Connection to 192.168.235.100 closed. [rootcode java]# vim /usr/local/bin/inotify.sh [rootcode java]# cat /usr/local/bin/inotify.sh #!/bin/bash /usr/local/bin/inotifywait -mrq -e modify,delete,create,attrib,move /root/app/java |while read events dorsync -av -e ssh -p 3333 --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup/echo $(date %F %T) fasheng$events /var/log/rsync.log 21 done [rootcode java]# pkill -f inotify.sh [1] 已终止 nohup ./inotify.sh(工作目录/usr/local/bin) (当前工作目录~/app/java) [rootcode java]# nohup /usr/local/bin/inotify.sh [1] 48232 [rootcode java]# nohup: 忽略输入并把输出追加到nohup.out jobs [1] 运行中 nohup /usr/local/bin/inotify.sh [rootcode java]# ls 1.java 2.java 3.java 4.java 5.java nohup.out [rootcode java]# touch 7.java [rootcode java]# ls 1.java 2.java 3.java 4.java 5.java 7.java nohup.out [rootcode java]# tail -5 /var/log/rsync.log 2025-05-24 21:28:14 fasheng/root/app/java/ MODIFY nohup.out 2025-05-24 21:28:14 fasheng/root/app/java/ MODIFY nohup.out 2025-05-24 21:28:14 fasheng/root/app/java/ MODIFY nohup.out 2025-05-24 21:28:15 fasheng/root/app/java/ MODIFY nohup.out 2025-05-24 21:28:15 fasheng/root/app/java/ MODIFY nohup.out [rootcode java]# rsync -e ssh -p 3333 -av --delete /root/app/java/ code192.168.235.100:/home/code/backup/java_backup sending incremental file list nohup.outsent 1,200 bytes received 1,061 bytes 1,507.33 bytes/sec total size is 119,281 speedup is 52.76 [rootcode java]# cd /root/app/javqa bash: cd: /root/app/javqa: 没有那个文件或目录 [rootcode java]# cd /root/app/java [rootcode java]# ls 1.java 2.java 3.java 4.java 5.java 7.java nohup.out [rootcode java]# tail -10 nohup.out sending incremental file list nohup.outsent 1,594 bytes received 1,607 bytes 6,402.00 bytes/sec total size is 183,011 speedup is 57.17 sending incremental file list nohup.outsent 1,733 bytes received 1,607 bytes 2,226.67 bytes/sec total size is 183,151 speedup is 54.84 [rootcode java]# tail -20 nohup.out sending incremental file list nohup.outsent 1,941 bytes received 1,709 bytes 2,433.33 bytes/sec total size is 195,191 speedup is 53.48 sending incremental file list nohup.outsent 2,082 bytes received 1,709 bytes 7,582.00 bytes/sec total size is 195,331 speedup is 51.52 sending incremental file list nohup.outsent 1,499 bytes received 1,715 bytes 6,428.00 bytes/sec total size is 195,471 speedup is 60.82 sending incremental file list nohup.outsent 1,665 bytes received 1,715 bytes 2,253.33 bytes/sec total size is 195,611 speedup is 57.87 [rootcode java]# is 57. 1,715 bytes 2,253.33 bytes/sec bash: is: 未找到命令... [rootcode java]# 1,715 bytes1,715 bytes list bash: 1,715: 未找到命令... [rootcode java]# 2,433.33forever bytesforever 在这里插入代码片 b: [rootlocalhost java_backup]# date 2025年 05月 24日 星期六 08:10:28 CST [rootlocalhost java_backup]# ls 35.txt aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java java [rootlocalhost java_backup]# ll 总用量 6148 -rw-r--r--. 1 code code 6291456 5月 20 21:37 35.txt drwxr-xr-x. 2 code code 6 5月 19 22:32 aa1 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa2 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa3 -rw-r--r--. 1 code code 0 5月 20 21:38 file19.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file1.java -rw-r--r--. 1 code code 0 5月 20 21:38 file20.java -rw-r--r--. 1 code code 0 5月 20 21:38 file21.java -rw-r--r--. 1 code code 0 5月 20 21:38 file22.java -rw-r--r--. 1 code code 0 5月 20 21:38 file23.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file2.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file3.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file4.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file5.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file6.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file7.java drwxr-xr-x. 12 code code 4096 5月 23 22:36 java [rootlocalhost java_backup]# cd /home/code/backup/java_backup [rootlocalhost java_backup]# ls 35.txt aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java java [rootlocalhost java_backup]# cd java [rootlocalhost java]# ls 21.java 321.java 322.java 333.java 34.txt 35.txt aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java]# ll 总用量 14336 -rw-r--r--. 1 code code 0 5月 23 22:18 21.java -rw-r--r--. 1 code code 3145728 5月 23 22:07 321.java -rw-r--r--. 1 code code 2097152 5月 23 22:26 322.java -rw-r--r--. 1 code code 3145728 5月 23 22:36 333.java -rw-r--r--. 1 code code 0 5月 23 22:22 34.txt -rw-r--r--. 1 code code 6291456 5月 20 21:37 35.txt drwxr-xr-x. 2 code code 6 5月 19 22:32 aa1 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa2 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa3 -rw-r--r--. 1 code code 0 5月 20 21:38 file19.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file1.java -rw-r--r--. 1 code code 0 5月 20 21:38 file20.java -rw-r--r--. 1 code code 0 5月 20 21:38 file21.java -rw-r--r--. 1 code code 0 5月 20 21:38 file22.java -rw-r--r--. 1 code code 0 5月 20 21:38 file23.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file2.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file3.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file4.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file5.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file6.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file7.java [rootlocalhost java]# cd - /home/code/backup/java_backup [rootlocalhost java_backup]# ls 21.java 321.java 322.java 333.java 34.txt 35.txt aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java java [rootlocalhost java_backup]# ll 总用量 14340 -rw-r--r--. 1 code code 0 5月 23 22:18 21.java -rw-r--r--. 1 code code 3145728 5月 23 22:07 321.java -rw-r--r--. 1 code code 2097152 5月 23 22:26 322.java -rw-r--r--. 1 code code 3145728 5月 23 22:36 333.java -rw-r--r--. 1 code code 0 5月 23 22:22 34.txt -rw-r--r--. 1 code code 6291456 5月 20 21:37 35.txt drwxr-xr-x. 2 code code 6 5月 19 22:32 aa1 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa2 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa3 -rw-r--r--. 1 code code 0 5月 20 21:38 file19.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file1.java -rw-r--r--. 1 code code 0 5月 20 21:38 file20.java -rw-r--r--. 1 code code 0 5月 20 21:38 file21.java -rw-r--r--. 1 code code 0 5月 20 21:38 file22.java -rw-r--r--. 1 code code 0 5月 20 21:38 file23.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file2.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file3.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file4.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file5.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file6.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file7.java drwxr-xr-x. 12 code code 4096 5月 23 22:36 java [rootlocalhost java_backup]# ll 总用量 14340 -rw-r--r--. 1 code code 0 5月 23 22:18 21.java -rw-r--r--. 1 code code 3145728 5月 23 22:07 321.java -rw-r--r--. 1 code code 2097152 5月 23 22:26 322.java -rw-r--r--. 1 code code 3145728 5月 23 22:36 333.java -rw-r--r--. 1 code code 0 5月 23 22:22 34.txt -rw-r--r--. 1 code code 6291456 5月 20 21:37 35.txt drwxr-xr-x. 2 code code 6 5月 19 22:32 aa1 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa2 drwxr-xr-x. 2 code code 6 5月 19 22:32 aa3 -rw-r--r--. 1 code code 0 5月 20 21:38 file19.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file1.java -rw-r--r--. 1 code code 0 5月 20 21:38 file20.java -rw-r--r--. 1 code code 0 5月 20 21:38 file21.java -rw-r--r--. 1 code code 0 5月 20 21:38 file22.java -rw-r--r--. 1 code code 0 5月 20 21:38 file23.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file2.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file3.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file4.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file5.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file6.java drwxr-xr-x. 2 code code 6 5月 19 22:30 file7.java drwxr-xr-x. 12 code code 4096 5月 23 22:36 java [rootlocalhost java_backup]# dd if/dev/zero of12.java bs12M count1 记录了10 的读入 记录了10 的写出 12582912字节(13 MB)已复制0.0460731 秒273 MB/秒 [rootlocalhost java_backup]# ls 12.java 321.java 333.java 35.txt aa2 file19.java file20.java file22.java file2.java file4.java file6.java java 21.java 322.java 34.txt aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java_backup]# ls 21.java 321.java 322.java 333.java 34.txt 35.txt aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls 21.java 333.java aa1 file19.java file21.java file2.java file5.java 321.java 34.txt aa2 file1.java file22.java file3.java file6.java 322.java 35.txt aa3 file20.java file23.java file4.java file7.java [rootlocalhost java_backup]# ls 21.java 333.java aa1 file19.java file21.java file2.java file5.java 321.java 34.txt aa2 file1.java file22.java file3.java file6.java 322.java 35.txt aa3 file20.java file23.java file4.java file7.java [rootlocalhost java_backup]# ls 21.java 333.java aa1 file19.java file21.java file2.java file5.java 321.java 34.txt aa2 file1.java file22.java file3.java file6.java 322.java 35.txt aa3 file20.java file23.java file4.java file7.java [rootlocalhost java_backup]# ls 21.java 333.java aa1 file19.java file21.java file2.java file5.java 321.java 34.txt aa2 file1.java file22.java file3.java file6.java 322.java 35.txt aa3 file20.java file23.java file4.java file7.java [rootlocalhost java_backup]# ls 21.java 333.java 66.java 69.java aa3 file20.java file23.java file4.java file7.java 321.java 34.txt 67.java aa1 file19.java file21.java file2.java file5.java 322.java 35.txt 68.java aa2 file1.java file22.java file3.java file6.java [rootlocalhost java_backup]# ls 21.java 321.java 322.java 333.java 34.txt 35.txt 66.java 67.java 68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls 21.java 321.java 322.java 333.java 34.txt 35.txt 66.java 67.java 68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls 322.java 333.java 34.txt 35.txt 66.java 67.java 68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls 34.txt 35.txt 66.java 67.java 68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls 34.txt 35.txt 66.java 67.java 68.java 69.java aa1 aa2 aa3 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls 34.txt 66.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java 35.txt 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java [rootlocalhost java_backup]# cat /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See # sshd_config(5) for more information.# This sshd was compiled with PATH/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value.# If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port 3712 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying #RekeyLimit default none# Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO# Authentication:#LoginGraceTime 2m PermitRootLogin No #StrictModes yes #MaxAuthTries 6 #MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you dont trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Dont read the users ~/.rhosts and ~/.shosts files #IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication yes# Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no# Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes# GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no# Set this to yes to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of PermitRootLogin without-password. # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to no. # WARNING: UsePAM no is not supported in Red Hat Enterprise Linux and may cause several # problems. UsePAM yes#AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #UsePrivilegeSeparation sandbox #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none# no default banner path #Banner none# Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS# override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server [rootlocalhost java_backup]# netstat -tuln |grep 3712 tcp 0 0 0.0.0.0:3712 0.0.0.0:* LISTEN tcp6 0 0 :::3712 :::* LISTEN [rootlocalhost java_backup]# ls 35.txt 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 66.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java_backup]# ls 35.txt 67.java 69.java aa2 file19.java file20.java file22.java file2.java file4.java file6.java 66.java 68.java aa1 aa3 file1.java file21.java file23.java file3.java file5.java file7.java [rootlocalhost java_backup]# cat /etc/sshd/ssh_config cat: /etc/sshd/ssh_config: 没有那个文件或目录 [rootlocalhost java_backup]# cd /etc/sshd bash: cd: /etc/sshd: 没有那个文件或目录 [rootlocalhost java_backup]# cd /etc/ssh [rootlocalhost ssh]# vim sshd_config [rootlocalhost ssh]# cat sshd_config # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See # sshd_config(5) for more information.# This sshd was compiled with PATH/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value.# If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying #RekeyLimit default none# Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO# Authentication:#LoginGraceTime 2m PermitRootLogin No #StrictModes yes #MaxAuthTries 6 #MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you dont trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Dont read the users ~/.rhosts and ~/.shosts files #IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication yes# Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no# Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes# GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no# Set this to yes to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of PermitRootLogin without-password. # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to no. # WARNING: UsePAM no is not supported in Red Hat Enterprise Linux and may cause several # problems. UsePAM yes#AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #UsePrivilegeSeparation sandbox #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none# no default banner path #Banner none# Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS# override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server [rootlocalhost ssh]# cd [rootlocalhost ~]# cd /home/code [rootlocalhost code]# cd backup [rootlocalhost backup]# ls java_backup [rootlocalhost backup]# systemctl restart network [rootlocalhost backup]# cd [rootlocalhost ~]# cat /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See # sshd_config(5) for more information.# This sshd was compiled with PATH/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value.# If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying #RekeyLimit default none# Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO# Authentication:#LoginGraceTime 2m PermitRootLogin No #StrictModes yes #MaxAuthTries 6 #MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you dont trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Dont read the users ~/.rhosts and ~/.shosts files #IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication yes# Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no# Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes# GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no# Set this to yes to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of PermitRootLogin without-password. # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to no. # WARNING: UsePAM no is not supported in Red Hat Enterprise Linux and may cause several # problems. UsePAM yes#AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #UsePrivilegeSeparation sandbox #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none# no default banner path #Banner none# Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS# override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server [rootlocalhost ~]# ip a 1: lo: LOOPBACK,UP,LOWER_UP mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 scope host lovalid_lft forever preferred_lft foreverinet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: BROADCAST,MULTICAST,UP,LOWER_UP mtu 1500 qdisc pfifo_fast state UP group default qlen 1000link/ether 00:0c:29:e9:ad:9e brd ff:ff:ff:ff:ff:ffinet 192.168.235.100/24 brd 192.168.235.255 scope global noprefixroute ens33valid_lft forever preferred_lft forever 3: virbr0: BROADCAST,MULTICAST mtu 1500 qdisc noqueue state DOWN group default qlen 1000link/ether 52:54:00:f5:ea:28 brd ff:ff:ff:ff:ff:ff 4: virbr0-nic: BROADCAST,MULTICAST mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000link/ether 52:54:00:f5:ea:28 brd ff:ff:ff:ff:ff:ff [rootlocalhost ~]# tail -5 /etc/passwd avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin 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 [rootlocalhost ~]# systemctl restart sshd [rootlocalhost ~]# cd /home/code/backup/java_backup [rootlocalhost java_backup]# ls 67.java aa1 file19.java file21.java file2.java file5.java 68.java aa2 file1.java file22.java file3.java file6.java 69.java aa3 file20.java file23.java file4.java file7.java [rootlocalhost java_backup]# ls 68.java aa2 file1.java file22.java file3.java file6.java 69.java aa3 file20.java file23.java file4.java file7.java aa1 file19.java file21.java file2.java file5.java [rootlocalhost java_backup]# ls 68.java 69.java aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java [rootlocalhost java_backup]# ls aa1 aa3 aa5 file1.java file21.java file23.java file3.java file5.java file7.java aa2 aa4 file19.java file20.java file22.java file2.java file4.java file6.java [rootlocalhost java_backup]# ls aa1 aa4 file1.java file22.java file3.java file6.java testfile aa2 aa5 file20.java file23.java file4.java file7.java testfile2 aa3 file19.java file21.java file2.java file5.java nohup.out testfile4.java [rootlocalhost java_backup]# ls aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java nohup.out testfile testfile2 testfile4.java testfile8.java [rootlocalhost java_backup]# ls aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java nohup.out testfile testfile2 testfile4.java testfile8.java [rootlocalhost java_backup]# ls aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java nohup.out testfile testfile2 testfile4.java testfile8.java [rootlocalhost java_backup]# ls aa1 aa2 aa3 aa4 aa5 file19.java file1.java file20.java file21.java file22.java file23.java file2.java file3.java file4.java file5.java file6.java file7.java nohup.out testfile testfile2 testfile4.java testfile8.java [rootlocalhost java_backup]# ls 1.java 2.java 3.java 4.java [rootlocalhost java_backup]# ls 1.java 2.java 3.java 4.java 5.java [rootlocalhost java_backup]# cat /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See # sshd_config(5) for more information.# This sshd was compiled with PATH/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value.# If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port 22 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying #RekeyLimit default none# Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO# Authentication:#LoginGraceTime 2m PermitRootLogin No #StrictModes yes #MaxAuthTries 6 #MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you dont trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Dont read the users ~/.rhosts and ~/.shosts files #IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication yes# Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no# Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes# GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no# Set this to yes to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of PermitRootLogin without-password. # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to no. # WARNING: UsePAM no is not supported in Red Hat Enterprise Linux and may cause several # problems. UsePAM yes#AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #UsePrivilegeSeparation sandbox #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none# no default banner path #Banner none# Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS# override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server [rootlocalhost java_backup]# vim /etc/ssh/sshd_config [rootlocalhost java_backup]# cat /etc/ssh/sshd_config # $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $# This is the sshd server system-wide configuration file. See # sshd_config(5) for more information.# This sshd was compiled with PATH/usr/local/bin:/usr/bin# The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value.# If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port 3333 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::HostKey /etc/ssh/ssh_host_rsa_key #HostKey /etc/ssh/ssh_host_dsa_key HostKey /etc/ssh/ssh_host_ecdsa_key HostKey /etc/ssh/ssh_host_ed25519_key# Ciphers and keying #RekeyLimit default none# Logging #SyslogFacility AUTH SyslogFacility AUTHPRIV #LogLevel INFO# Authentication:#LoginGraceTime 2m PermitRootLogin No #StrictModes yes #MaxAuthTries 6 #MaxSessions 10#PubkeyAuthentication yes# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2 # but this is overridden so installations will only check .ssh/authorized_keys AuthorizedKeysFile .ssh/authorized_keys#AuthorizedPrincipalsFile none#AuthorizedKeysCommand none #AuthorizedKeysCommandUser nobody# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts #HostbasedAuthentication no # Change to yes if you dont trust ~/.ssh/known_hosts for # HostbasedAuthentication #IgnoreUserKnownHosts no # Dont read the users ~/.rhosts and ~/.shosts files #IgnoreRhosts yes# To disable tunneled clear text passwords, change to no here! #PasswordAuthentication yes #PermitEmptyPasswords no PasswordAuthentication yes# Change to no to disable s/key passwords #ChallengeResponseAuthentication yes ChallengeResponseAuthentication no# Kerberos options #KerberosAuthentication no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes #KerberosGetAFSToken no #KerberosUseKuserok yes# GSSAPI options GSSAPIAuthentication yes GSSAPICleanupCredentials no #GSSAPIStrictAcceptorCheck yes #GSSAPIKeyExchange no #GSSAPIEnablek5users no# Set this to yes to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of PermitRootLogin without-password. # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to no. # WARNING: UsePAM no is not supported in Red Hat Enterprise Linux and may cause several # problems. UsePAM yes#AllowAgentForwarding yes #AllowTcpForwarding yes #GatewayPorts no X11Forwarding yes #X11DisplayOffset 10 #X11UseLocalhost yes #PermitTTY yes #PrintMotd yes #PrintLastLog yes #TCPKeepAlive yes #UseLogin no #UsePrivilegeSeparation sandbox #PermitUserEnvironment no #Compression delayed #ClientAliveInterval 0 #ClientAliveCountMax 3 #ShowPatchLevel no #UseDNS yes #PidFile /var/run/sshd.pid #MaxStartups 10:30:100 #PermitTunnel no #ChrootDirectory none #VersionAddendum none# no default banner path #Banner none# Accept locale-related environment variables AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS# override default of no subsystems Subsystem sftp /usr/libexec/openssh/sftp-server# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server [rootlocalhost java_backup]# [rootlocalhost java_backup]# ls bash: [rootlocalhost: 未找到命令... [rootlocalhost java_backup]# 1.java 2.java 3.java 4.java 5.java bash: 1.java: 未找到命令... [rootlocalhost java_backup]# .java .java 5.java bash: .java: 未找到命令... 相似命令是 java [rootlocalhost java_backup]# systemctl restart sshd [rootlocalhost java_backup]# ls 1.java 2.java 3.java 4.java 5.java 7.java nohup.out [rootlocalhost java_backup]# 参考
http://www.pierceye.com/news/665641/

相关文章:

  • 肃州区建设局网站宁夏百度seo
  • 关于做电影的网站设计西安网站建设制作 熊掌号
  • idc网站建设怎么自己做一个网页链接
  • 网站开发安全模块方案个人网站搭建软件
  • 重庆建设招标造价信息网站个人网站建设与维护
  • 网站备案用户名忘了怎么办嘉兴做外贸网站的公司
  • 1688网站的特点网站制作器手机版下载
  • 兖州网站开发做一个中英文网站多少钱
  • wordpress怎么做网盘站好看的页面图片
  • 建设网站深圳罗湖安徽合肥做网站
  • 一级a做爰片免费网站下载网站快慢由什么决定
  • 网页设计与网站建设 郑州大学网络购物网站备案
  • 美观网站建设哪家好优化大师最新版下载
  • 外贸品牌网站制作wordpress 微信主题
  • 旅游网站开发需求分析网站的根目录的路径
  • easyUI网站开发docker wordpress mysql
  • dede手机网站模板下载黄冈做网站
  • 诸城网站建设葛小燕现在搜索引擎哪个比百度好用
  • 嘉兴做微网站多少钱注册网页需要多少钱
  • 论坛类网站设计大型网站系统解决方案
  • 网站建设中页面设计广告策划书籍
  • 云南省建设工程投标中心网站网页的制作步骤是什么
  • 保定网站设计概述更换动易网站模板的方法
  • 新手如何注册网站域名做 理财网站有哪些
  • 南宁快速建站模板企业网站的开发与应用
  • 网站运营适合什么样的人做企业宣传及介绍ppt
  • 怎么样网站开源小升初在线做试卷的网站
  • 中国建设银行章丘支行网站网站排版设计欣赏
  • 儿童摄影网站建设专业做网站制作自助建站系统
  • 注册做网站的公司有哪些wordpress 4.1 下载