转载来自: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
- #yum install ftp
一路yes,最后提示安装成功。
2. 配置vsftpd.conf。
- #vi /etc/vsftpd/vsftpd.conf
将vsftpd.conf文件中的主要设置如下:
- anonymous_enable=YES #允许匿名访问
- local_enable=YES #允许本地用户访问(/etc/passwd中的用户)
- write_enable=YES #允许写入权限,包括修改,删除
- anon_upload_enable=YES #允许匿名用户上传
- anon_mkdir_write_enable=YES #允许匿名用户建立目录
- ascii_upload_enable=YES #允许ascii上传
- 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
- #service vsftpd start
有时候启动vvsftp的时候会出现错误:50000PS,can not read vsftp.conf文件
试着用root用户来进行启动,就可以正确启动了
4. 让vsftpd自启动
- #chkconfig --level 2345 vsftpd on
- #chkconfig --list vsftpd
匿名登录ftp:
用户名和密码都是:anonymous
使用仙人掌的配置文件,tfp的共享目录为:/var/ftp/
5. 让root用户可以ftp上传
在/etc/vsftpd/目录下有两个文件:ftpusers和user_list,里面记录的用户无法使用通过ftp进行访问。删掉里面root的记录,然后通过:
- #setsebool -P ftpd_disable_trans 1
fedora 下面关闭selinux就可以了
- vi /etc/selinux/config
- SELINUX=disabled
6. 重启vsftpd
- #service vsftpd restart
出现 "500 OOPS:cannot change directory:/root" 错误,如何解决呢?
解决:
1、 查看 SELinux 的状态: sestatus -b | grep ftp 确切地说,只是查看了ftp的状态。
2、 在出现的结果中可以看到
- ftp_home_dir off
- 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服务器。。。好奇怪的说。】
在菜单中选择“System”——“Administration”——“services”,打开“服务配置”窗口。
在“服务配置”窗口中找到“vsftp”,再单击工具栏上的“enable”和“start”按钮。可以在右边状态栏中看到一些成功启动的信息.
随后再打开刚才的“服务配置”窗口,重启“iptable”服务(就是点击那个restart),让刚才的修改生效。
在vsftp.conf文件里面,设置writable = yes
相应的目标目录放开write权限。
chmod 775 xxx
另外,vsftp会受Selinux影响,注意检查相应的布尔参数。
在命令行里输入
#system-config-selinux
等待打开,然后找到ftp,再然后在对应地方打沟就可以了。
顺便说一下 在fedora下面挂载NFS文件系统的时候 需要重启nfs ;;/etc/init.d/nfs restart 具体的原因我现在还不知道。