<p>打开/etc/selinux/config</p><p>将selinux=enforcing或permissive改成disabled。</p><p>记得要重新启动服务器!</p><p>当然还要确定以下问题:</p><p>1, 用户是否被 vsftpd 限制登录, 比如用户名在 /etc/ftpusers 中,并被阻止登录了</p><p>2, vsftpd.conf 中是否打开了pam认证的选项 (自己编译安装的时候常因为这个出错) (看vsftpd.conf中是否有pam_service_name=ftp或vsftpd.到底是哪个要看
auth required /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required /lib/security/pam_unix.so shadow nullok
auth required /lib/security/pam_shells.so
account required /lib/security/pam_unix.so
session required /lib/security/pam_unix.so
如果/etc/ftpusers有的用户将被deny</p><div style="page-break-after: always;"><span style="display: none;"><!--more-->& nbsp ;</span></div><p>3, 相关文件夹的权限是否正确.</p><p>关于“vsftpd 部分本地用户不能登录,部分可以”的问题,
500 OOPS: cannot change directory:/home/xxxx
Login failed.
421 Service not available, remote server has closed connection</p><p>他们的home目录都是/home/xxxx。/home和/home/xxxx的权限都是755。
# useradd -G test -d /tmp/usr1 usr1
/dev/hdb1 on / type ext3 (rw)
/dev/hda9 on /home type ext2 (rw)</p><p>所以,我猜想:是否是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录呢?</p><p>为了验证以上设想,我试着再创建了一个帐号
useradd -G test -d /home/usr3 usr3
/home, /home/usr3 的权限都是755。</p><p>usr3 ftp登录失败。
500 OOPS: cannot change directory:/home/usr3
Login failed.
421 Service not available, remote server has closed connection</p><p>至此,我觉得可以确定是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录。</p><p>参考文章:
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.</p><p>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</p><p>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. [:)]</p><p>The major difference, so far for me, in Red Hat’s SELinux is the way ftp is handled. 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 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.</p><p>Of all the issues I saw most notable is if you want to enable chroot directory’s outside of the normal /home/xxx vsftpd. These will fail with a</p><p>500 OOPS: cannot change directory: /mnt/xxxxx</p><p>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) vsftpd barfs the above.</p><p>I found information at the NSA that indicates you can disable SELinux protection of the ftp daemon.</p><p>setsebool -P ftpd_disable_trans 1</p><p>This seems a bit drastic. It certainly works for now though.</p><p>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.</p><p>解决办法:
# setsebool ftpd_disable_trans 1</p><p># service vsftpd restart</p><p>在ssh输入命令:
setsebool ftpd_disable_trans 1
service vsftpd restart</p><p>解决方法如下,需要将capability模块加载,
# modprobe capability
CONFIG_SECURITY_CAPABILITIES: This enables the “default” Linux capabilities functionality.
If you are unsure how to answer this question, answer Y.
Prompt: Default Linux Capabilities
Defined at security/Kconfig:56
Depends on: SECURITY
-> Security options
-> Enable different security models (SECURITY [=y])</p>