始创于2000年 股票代码:831685
咨询热线:0371-60135900 注册有礼 登录
  • 挂牌上市企业
  • 60秒人工响应
  • 99.99%连通率
  • 7*24h人工
  • 故障100倍补偿
您的位置: 网站首页 > 帮助中心>文章内容

vsftpd本地用户不能登录问题的解决

发布时间:  2012/8/11 11:23:53
 打开/etc/selinux/config

将selinux=enforcing或permissive改成disabled。

记得要重新启动服务器!

当然还要确定以下问题:

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

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

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

#%PAM-1.0
authrequired/lib/security/pam_listfile.soitem=usersense=denyfile=/etc/ftpusersonerr=succeed
authrequired/lib/security/pam_unix.soshadownullok
authrequired/lib/security/pam_shells.so
accountrequired/lib/security/pam_unix.so
sessionrequired/lib/security/pam_unix.so
如果/etc/ftpusers有的用户将被deny

3,相关文件夹的权限是否正确.

关于“vsftpd部分本地用户不能登录,部分可以”的问题,

系统中原来就有的本地帐号都不能登录,我的/etc/vsftpd/vsftpd.conf文件的配置如下:

local_enable=YES
write_enable=YES
chroot_local_user=YES
pam_service_name=vsftpd
/etc/pam.d/vsftpd存在且正常。

登录时错误信息都是一样的:

500OOPS:cannotchangedirectory:/home/xxxx
Loginfailed.
421Servicenotavailable,remoteserverhasclosedconnection

他们的home目录都是/home/xxxx。/home和/home/xxxx的权限都是755。

以上这些帐号都不能ftp登录,这些都是平常经常使用的,可以用shell登录的。

我新创建了一个usr1帐号

#useradd-Gtest-d/tmp/usr1usr1

能ftp登录,他的home为/tmp/usr1,在/分区上。而/home我是mount到/dev/hda9上的。

#mount
/dev/hdb1on/typeext3(rw)
/dev/hda9on/hometypeext2(rw)

所以,我猜想:是否是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录呢?

为了验证以上设想,我试着再创建了一个帐号

useradd-Gtest-d/home/usr3usr3

/home,/home/usr3的权限都是755。

usr3ftp登录失败。

500OOPS:cannotchangedirectory:/home/usr3

Loginfailed.

421Servicenotavailable,remoteserverhasclosedconnection

至此,我觉得可以确定是由于/home分区的原因,而造成“主目录在/home分区的帐号”都不能登录。

参考文章:

IfinishedmysecondupgradetoFedoraCore4.Noteverythingisironedoutyetwiththebuildofcourse.ButonethingisforsurealothashappenedtotheRedHatIknewbefore.

Imustsayofallthechanges,formethenicestadditionisthenewSELinuxextensions.FordeepbackgroundonthereasonsforandtheoryofSELinuxread,TheInevitabilityofFailure:TheFlawedAssumptionofSecurityinModernComputingEnvironments

ThemoreIworkwithSELinuxthemoreIrealizeIneedtoknowaboutit,andhowexactlyitdoesallitsstuff.Itcertainlychangesthingsrelatingtousers,directoriesandaccess.AsIamstartingtolearnit,I'msureI'mdoingthingsthehard-way.:)

Themajordifference,sofarforme,inRedHat'sSELinuxisthewayftpishandled.vsftpdisstilltheserverwhichisgreat.However,itseemstobedesignedtorunasadaemonratherthaninvokedviaxinet.d.Ifyougrabaworkingcopyofthexinet.dfileforvsftpdyoucaninvokeitviaxinet.dwrapper.Ididmyfirstserverupgradeinthismanner.ThecurrentoneIamtryingasadaemon.IcertainlythinkIwillmisssomeofthefeaturesthatthexinet.dwrapperbrings,andmayyetreturntoit.

OfalltheissuesIsawmostnotableisifyouwanttoenablechrootdirectory'soutsideofthenormal/home/xxxvsftpd.Thesewillfailwitha

500OOPS:cannotchangedirectory:/mnt/xxxxx

IwasabletouseftpifIloggedinwithanaccountwithadirectoryin/home,butonceIsetauseraccounttohaveahomedriveoutsideof/home(inthiscaseonamountedsecondarydisk)vsftpdbarfstheabove.

IfoundinformationattheNSAthatindicatesyoucandisableSELinuxprotectionoftheftpdaemon.

setsebool-Pftpd_disable_trans1

Thisseemsabitdrastic.Itcertainlyworksfornowthough.

Ithinkultimatelytheissueresideswithpolicies,butasSELinuxpoliciesarenewtome,itwilltaketimebeforeitallgetssortedout.AsIspendtimewiththenewSELinuxextensionsinFedoraCore4Iwillkeepyouupdatedonmythoughtsandconfigurationlessons.

解决办法:

#setseboolftpd_disable_trans1

#servicevsftpdrestart

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


本文出自:亿恩科技【www.enkj.com】

服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]

  • 您可能在找
  • 亿恩北京公司:
  • 经营性ICP/ISP证:京B2-20150015
  • 亿恩郑州公司:
  • 经营性ICP/ISP/IDC证:豫B1-20183354
  • 亿恩南昌公司:
  • 经营性ICP/ISP证:赣B2-20080012
  • 服务器/云主机 24小时售后服务电话:0371-60135900
  • 虚拟主机/智能建站 24小时售后服务电话:0371-60135900
  • 网络版权侵权举报电话:0371-60135995
  • 警情提示:注意防范电信网络诈骗
  • 专注服务器托管17年
    扫扫关注-微信公众号
    0371-60135900
    Copyright© 1999-2026 ENKJ All Rights Reserved 地址:郑州市高新区翠竹街1号总部企业基地亿恩大厦  法律顾问:河南亚太人律师事务所郝建锋、杜慧月律师  B1-20183354   京公网安备41019702002023号 
      0
     
     
     
     

    0371-60135900
    7*24小时客服服务热线