Fedora vsftpd限制登录安装配置

系统 Linux
Fedora vsftpd.conf 中是否打开了pam认证的选项 (自己编译安装的时候常因为这个出错) (看Fedora vsftpd.conf中是否有pam_service_name=ftp或Fedora vsftpd.到底是哪个要看。

想知道到Fedora vsftpd系统的真相么,想知道Fedora vsftpd系统中藏有的内在奥义么,只有我来给大家全面讲解介绍Fedora vsftpd系统打开/etc/selinux/config 将selinux=enforcing或permissive改成disabled。记得要重新启动服务器! 当然还要确定以下问题:

1、用户是否被 Fedora vsftpd 限制登录, 比如用户名在 /etc/ftpusers 中,并被阻止登录了

2、Fedora vsftpd.conf 中是否打开了pam认证的选项 (自己编译安装的时候常因为这个出错) (看Fedora vsftpd.conf中是否有pam_service_name=ftp或Fedora vsftpd.到底是哪个要看。

PAM模块的服务文件/etc/pam.d下是谁.我的是ftp且它的配置如下: #%PAM-1.0

  1. auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed   
  2. auth required /lib/security/pam_unix.so shadow nullok   
  3. auth required /lib/security/pam_shells.so   
  4. account required /lib/security/pam_unix.so   
  5. session required /lib/security/pam_unix.so 如果/etc/ftpusers有的用户将被deny  

3、相关文件夹的权限是否正确 关于“Fedora vsftpd 部分本地用户不能登录,部分可以”的问题, 系统中原来就有的本地帐号都不能登录,我的/etc/Fedora vsftpd/Fedora vsftpd.conf文件的配置如下:

  1. local_enable=YES   
  2. write_enable=YES   
  3. chroot_local_user=YES   
  4. pam_service_name=Fedora vsftpd   
  5. /etc/pam.d/Fedora vsftpd存在且正常。   
  6. 登录时错误信息都是一样的:  

500 OOPS: cannot change directory:/home/xxxx Login failed. 421 Service not available, remote server has closed connection 他们的home目录都是/home/xxxx。/home和/home/xxxx的权限都是755。以上这些帐号都不能ftp登录,这些都是平常经常使用的,可以用shell登录的。

我新创建了一个usr1帐号 # useradd -G test -d /tmp/usr1 usr1 能ftp登录,他的home为/tmp/usr1,在/分区上。而/home我是mount到/dev/hda9上的。 #mount /dev/hdb1 on / type ext3 (rw) /dev/hda9 on /home type ext2 (rw) 所以,我猜想:是否是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录呢?

为了验证以上设想,我试着再创建了一个帐号 useradd -G test -d /home/usr3 usr3 /home, /home/usr3 的权限都是755。 usr3 ftp登录失败。 500 OOPS: cannot change directory:/home/usr3 Login failed. 421 Service not available, remote server has closed connection 至此,我觉得可以确定是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录。

参考文章:

I finished my second upgrade to Fedora Core 4. Not everything is ironed out yet with the build of course. But one thing is for sure a lot has happened to the RedHat I knew before.

I must say of all the changes, for me the nicest addition is the new SELinux extensions. For deep background on the reasons for and theory of SELinux read, The Inevitability of Failure: The Flawed Assumption of Security in Modern Computing Environments

The more I work with SELinux the more I realize I need to know about it, and how exactly it does all its stuff. It certainly changes things relating to users, directories and access. As I am starting to learn it, I'm sure I'm doing things the hard-way. :)

The major difference, so far for me, in Red Hat's SELinux is the way ftp is handled. Fedora vsftpd is still the server which is great. However, it seems to be designed to run as a daemon rather than invoked via xinet.d. If you grab a working copy of the xinet.d file for Fedora vsftpd you can invoke it via xinet.d wrapper. I did my first server upgrade in this manner. The current one I am trying as a daemon. I certainly think I will miss some of the features that the xinet.d wrapper brings, and may yet return to it.

Of all the issues I saw most notable is if you want to enable chroot directory's outside of the normal /home/xxx Fedora vsftpd. These will fail with a 500 OOPS: cannot change directory: /mnt/xxxxx

I was able to use ftp if I logged in with an account with a directory in /home, but once I set a user account to have a home drive outside of /home (in this case on a mounted secondary disk) Fedora vsftpd barfs the above.

I found information at the NSA that indicates you can disable SELinux protection of the ftp daemon. setsebool -P ftpd_disable_trans 1 This seems a bit drastic. It certainly works for now though.

I think ultimately the issue resides with policies, but as SELinux policies are new to me, it will take time before it all gets sorted out. As I spend time with the new SELinux extensions in Fedora Core 4 I will keep you updated on my thoughts and configuration lessons.

解决办法:

# setsebool ftpd_disable_trans 1
# service Fedora vsftpd restart

我用的是FC4,按照你上一帖子里的方法试了,马上就解决了。所以,可以确定原因就在SELinux。 

他的系统是CentOS,是RH派系的。我把Fedora vsftpd安装配置好了,以为大功告成,但客户端访问提示如下错误:500 OOPS: cannot change directory:/home/ftp原因是他的CentOS系统安装了SELinux,因为默认下是没有开启FTP的支持,所以访问时都被阻止了。

  1. //查看SELinux设置# getsebool -a|grep ftpftpd_disable_trans --> off或者ftp_home_dir-->off  
  2. //使用setsebool命令开启# setsebool ftpd_disable_trans 1或者# setsebool ftp_home_dir 1  
  3. //查看当前状态是否是on的状态# getsebool -a|grep ftpftpd_disable_trans --> on或者ftp_home_dir-->on  
  4. //setsebool使用-P参数,无需每次开机都输入这个命令# setsebool -P ftpd_disable_trans 1或者  
  5. # setsebool -P ftp_home_dir 1# service Fedora vsftpd restart 

有关selinux的配置如关闭,仅仅警告,强制等等 需要编辑/etc/sysconfig/selinux 默认是强制

【编辑推荐】

  1. Fedora vsftpd配置文件的说明一些常用功能的实现
  2. Fedora vsFTPd和防火墙及SELINUX的关系
  3. Fedora vsFTPd服务器的安装启动和关闭
  4. Fedora vmware启动ghost computer中的Linux
  5. Fedora Continue打印文档时用CanoniP1000
责任编辑:佚名 来源: CSDN
相关推荐

2011-03-02 10:41:41

Vsftpd安装

2010-01-11 14:46:41

vsftpd配置

2011-02-23 09:55:33

Centos安装vsftpd

2009-07-26 22:23:12

Fedora 8JDKEclipse

2011-03-02 09:31:13

2011-03-02 09:31:13

2010-02-26 09:55:59

Fedora apac

2009-07-08 15:20:36

JDK 6.0的安装配Fedora 8

2015-09-22 13:57:29

vsftp虚拟用户CentOS

2011-03-01 09:09:39

Ubuntuvsftpd安装

2010-02-24 13:55:18

Fedora vsFT

2010-03-02 15:57:24

Fedora CVS服

2011-04-02 14:21:46

MRTG安装

2011-04-01 15:00:35

2011-02-23 10:43:17

2011-02-25 17:48:52

2010-06-07 11:22:28

2010-01-11 17:29:07

2011-03-02 11:32:55

vsftpd配置

2011-03-30 15:05:40

MRTG安装
点赞
收藏

51CTO技术栈公众号