fedora 安装配置ftp

转载来自:http://blog.csdn.net/maai1024/article/details/6099844   和http://blog.sina.com.cn/s/blog_6e8c5ff30101kv6z.html

Fedora版本:Fedora 12

关闭防火墙:

1、快速关闭SElinux,使用如下命令就可以:
  /usr/sbin/setenforce 0 立刻关闭 SELINUX
  /usr/sbin/setenforce 1 立刻启用 SELINUX
2、加到系统默认启动里面
  echo "/usr/sbin/setenforce 0" >> /etc/rc.local
3、可以编辑配置文件达到同样的目的
     vi /etc/selinux/conf

     set SELINUX=disabled

1. 安装vsftp

[java]  view plain copy
  1. #yum install ftp

一路yes,最后提示安装成功。

2. 配置vsftpd.conf。

[java]  view plain copy
  1. #vi /etc/vsftpd/vsftpd.conf  
 

将vsftpd.conf文件中的主要设置如下:

[java]  view plain copy
  1. anonymous_enable=YES    #允许匿名访问  
  2. local_enable=YES    #允许本地用户访问(/etc/passwd中的用户)  
  3. write_enable=YES    #允许写入权限,包括修改,删除  
  4. anon_upload_enable=YES    #允许匿名用户上传  
  5. anon_mkdir_write_enable=YES    #允许匿名用户建立目录  
  6. ascii_upload_enable=YES    #允许ascii上传  
  7. ascii_download_enable=YES        #允许ascii下载  

 仙人掌的vsftp.config文件如下:此文件经过测试可以匿名登录

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they


------------------------结束----------------------------------------------------

3. 启动vsftp

[java]  view plain copy
  1. #service vsftpd start  

 有时候启动vvsftp的时候会出现错误:50000PS,can not read vsftp.conf文件

试着用root用户来进行启动,就可以正确启动了

4. 让vsftpd自启动

[java]  view plain copy
  1. #chkconfig --level 2345 vsftpd on  
  2. #chkconfig --list vsftpd  

 匿名登录ftp:

用户名和密码都是:anonymous

使用仙人掌的配置文件,tfp的共享目录为:/var/ftp/

5. 让root用户可以ftp上传

在/etc/vsftpd/目录下有两个文件:ftpusers和user_list,里面记录的用户无法使用通过ftp进行访问。删掉里面root的记录,然后通过:

[java]  view plain copy
  1. #setsebool -P ftpd_disable_trans 1  
 

fedora 下面关闭selinux就可以了 

[java]  view plain copy
  1. vi /etc/selinux/config   
  2.   
  3. SELINUX=disabled  
 

6. 重启vsftpd

[java]  view plain copy
  1. #service vsftpd restart  
 

 

 

出现 "500 OOPS:cannot change directory:/root" 错误,如何解决呢? 

解决: 

1、 查看 SELinux 的状态:  sestatus -b | grep ftp      确切地说,只是查看了ftp的状态。 

2、 在出现的结果中可以看到 

[java]  view plain copy
  1. ftp_home_dir        off    
  2. tftpd_disable_trans   off   


之类。我们现在只要把其中之一设置为on就可以啦。 

3、 setsebool -P ftpd_disable_trans on      或者 setsebool -P  ftp_home_dir  on 

4、 重启vsftpd:  service vsftpd restart 

 

另一篇博文是 :

 有段时间没用linux,今天打开发现在Win7下竟然无法连接linux的FTP服务器。。。好奇怪的说。】

      所以百度了下,很快就解决了,是linux下的FTP服务器慕名奇妙的关闭了呵呵。
      下面说下开启方法吧!
      fedora发布时,往往已经将vsftp服务器软件包含在套件之间,在fedora中安装vsftp非常简易,方法自己百度,这里默认已经安装好了,并以fedora10做为参考。
      在fedora中,vsftp服务器软件安装后,默认是作为一个独立的ftp服务器而存在的,启动vsftp服务器的方法如下:
在菜单中选择“System”——“Administration”——“services”,打开“服务配置”窗口。
在“服务配置”窗口中找到“vsftp”,再单击工具栏上的“enable”和“start”按钮。可以在右边状态栏中看到一些成功启动的信息.
vsftp正常启动后,ftp客户端仍然不能访问ftp服务器或上传/下载文件,这是因为fedora系统的防火墙或selinux设置阻止了vsftp服务器的正常使用。所以在用户能够使用vsftp服务器的功能之前,还必须进行相关的安全设置。
在菜单中选择  “System”——“Administration”——“firewall”  ,打开“防火墙配置”窗口,在下面的列表中选中“ftp”,单击“apply”按钮。
随后再打开刚才的“服务配置”窗口,重启“iptable”服务(就是点击那个restart),让刚才的修改生效。
      至此,OK啦。。。

补充:如果此时FTP只能下载,不能上传
 
 
在vsftp.conf文件里面,设置writable = yes
相应的目标目录放开write权限。
chmod 775 xxx
另外,vsftp会受Selinux影响,注意检查相应的布尔参数。
在命令行里输入
#system-config-selinux
等待打开,然后找到ftp,再然后在对应地方打沟就可以了。


顺便说一下 在fedora下面挂载NFS文件系统的时候 需要重启nfs ;;/etc/init.d/nfs restart  具体的原因我现在还不知道。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值