ready:
1. Log source directory: 172.16.1.103:/usr/logdata/url/
2. Log target directory: 172.16.1.102:/home/zion/url/
The file server server on the 3.102 machine has been installed ( tutorial )
The file server client has been installed on the 4.103 machine
Claim:
The following three are indispensable! !
1. On the machine (102) where the ftp server is located, the server opens SELinux
SELinux is a Linux kernel module and a security subsystem of Linux. Its main function is to minimize the resources that can be accessed by the service process in the system (the principle of least privilege).
#1 查看SELinux状态,enabled即为开启状态
[root@fan102 ~]# getenforce
#2 关闭SELinux
#2.1 临时关闭(不用重启机器)
[root@fan102 ~]# setenforce 0
#2.2 永久关闭(修改配置文件需要重启机器)
[root@fan102 ~]# vi /etc/selinux/config
将 SELINUX=enforcing 改为 SELINUX=disabled
2. On the machine (102) where the ftp server is located, enable the write permission (/etc/vsftpd/vsftpd.conf)
[root@fan102 ~]# vi /etc/vsftpd/vsftpd.conf
write_enable=YES //是否对登录用户开启写权限。属全局性设置。默认NO
3. On the machine (102) where the ftp server is located, make sure that the log target path (/home/zion/url/) is 755
[root@fan102 ~]# chmod -R 755 /home/zion
Script (ftpput.csh)
#!/bin/csh
#日志格式XXX202010220812.xxx.log
set param=`date -d "1hour ago" "+%Y%m%d%H"`
ftp -n<<EOF
open 172.16.1.102
user zion 123123
lcd /usr/logdata/url
cd /home/zion/url
prompt
mput *$param*
close
bye
EOF
The script is a csh script, and the parameter settings are slightly different from sh
After writing, upload to 103 and execute (./ftpput.csh)
+++++++++++++++++++++++++++++++++++++++++
+ If you have any questions, you can +Q: 1602701980 Discuss together +
+++++++++++++++++++++++++++++++++++++++++