This article mainly introduces how to use ftp on the windows desktop to upload files to the linux server. Friends in need can refer to it
First of all, Install ftp
[root@host2 test]#yum -y install ftp vsftpd [root@host2 test]#service vsftpd start [root@host2 test]#chkconfig vsftpd --list [root@host2 test]#/etc/init.d/iptables stop [root@host2 test]# ftp 192.168.0.142 Connected to 192.168.0.142 (192.168.0.142). 220 (vsFTPd 2.2.2) Name (192.168.0.142:root): ftp 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd pub 250 Directory successfully changed. ftp> put /root/test/test.txt local: /root/test/test.txt remote: /root/test/test.txt 227 Entering Passive Mode (192,168,0,142,140,140). 550 Permission denied. ftp> quit 221 Goodbye. //直接安装起服务,使用匿名登录后,上传文件会提示拒绝访问,这时我们需要修改一些文件 [root@host2 test]# getsebool -a | grep ftp allow_ftpd_anon_write --> off allow_ftpd_full_access --> off allow_ftpd_use_cifs --> off allow_ftpd_use_nfs --> off ftp_home_dir --> off ftpd_connect_db --> off ftpd_use_fusefs --> off ftpd_use_passive_mode --> off httpd_enable_ftp_server --> off tftp_anon_write --> off tftp_use_cifs --> off tftp_use_nfs --> off [root@host2 test]# setsebool -P allow_ftpd_anon_write 1 //-P是永久保存生效 [root@host2 test]# setsebool -P allow_ftpd_full_access 1 [root@host2 test]# setsebool -P ftp_home_dir 1 [root@host2 test]# !get getsebool -a | grep ftp allow_ftpd_anon_write --> on allow_ftpd_full_access --> on allow_ftpd_use_cifs --> off allow_ftpd_use_nfs --> off ftp_home_dir --> on ftpd_connect_db --> off ftpd_use_fusefs --> off ftpd_use_passive_mode --> off httpd_enable_ftp_server --> off tftp_anon_write --> off tftp_use_cifs --> off tftp_use_nfs --> off [root@host2 ]# vim /etc/vsftpd/vsftpd.conf //修改配置参数 anon_mkdir_write_enable=YES //匿名可创建目录 anon_other_write_enable=YES //匿名删除,重命名 anon_upload_enable=YES //匿名用户是否可以上传文件 [root@host2 ]#service vsftpd restart [root@host2 ftp]#cd /var/ftp [root@host2 ftp]mkdir ftp_test [root@host2 ftp]chown ftp:root ftp_test //修改用户属主
on the linux server and then you can test it~~
Create a new file anonymously, rename and You can delete it
If an error of 550 occurs, it means there is a problem with the permission settings on the server. If it is 553, it means that there is a problem with the configuration file
Appendix: /etc/ vsftpd/vsftpd.conf configuration parameters Key field meaning:anonymous_enable=YES #开启匿名共享 local_enable=YES #开启本地账户共享 write_enable=YES #本地账户是否可写 anon_upload_enable=YES #匿名用户是否可以上传文件 anon_mkdir_write_enable=YES #匿名可创建目录 anon_other_write_enable=YES #匿名删除,重命名 chroot_local_user #禁锢本地账户 anon_root=/abc #定义匿名用户根目录为/abc目录 anon_umask=022 #定义匿名用户上传的掩码值 listen_address=192.168.0.5 #定义监听地址为192.168.0.5 listen_port=端口号 listen_address=IP地址 max_clients=最大并发连接数 max_per_ip=同一IP地址的最大并发连接数 anon_max_rate=匿名用户访问速度(字节/秒) local_max_rate=本地用户访问速度(字节/秒)
/etc/vsftpd/ftpusers(黑名单) /etc/vsftpd/user_list(黑/白名单)
The above is the detailed content of About how to upload files to linux server via ftp on windows desktop. For more information, please follow other related articles on the PHP Chinese website!