关于windows桌面上ftp如何上传文件到linux服务器

黄舟
Release: 2017-06-04 11:19:52
Original
2370 people have browsed it

这篇文章主要介绍了如何在windows桌面使用ftp上传文件到linux服务器,需要的朋友可以参考下

首先在linux服务器上安装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  //修改用户属主
Copy after login

然后就可以测试了~~

匿名新建文件,重命名和删除都可以了

如果出现550的报错,代表的是服务端的权限设置有问题,553的话就是配置文件有问题

附录:/etc/vsftpd/vsftpd.conf配置参数

重点字段意义:

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=本地用户访问速度(字节/秒)
Copy after login

在字段userlist_enable=YES或NO //是否开启user_list文件

在字段userlist_deny=NO时user_list是白名单

 /etc/vsftpd/ftpusers(黑名单)
/etc/vsftpd/user_list(黑/白名单)
Copy after login

默认的vsftpd服务:

     允许匿名FTP访问,只能下载不能上传 【/var/ftp/】

     允许本地用户FTP访问,既可以下载,也可以上传 【~用户名】

The above is the detailed content of 关于windows桌面上ftp如何上传文件到linux服务器. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!