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 3,相關文件夾的權限是否正確. 關于“vsftpd部分本地用戶不能登錄,部分可以”的問題, 系統中原來就有的本地帳號都不能登錄,我的/etc/vsftpd/vsftpd.conf文件的配置如下: local_enable=YES 登錄時錯誤信息都是一樣的: 500OOPS:cannotchangedirectory:/home/xxxx 他們的home目錄都是/home/xxxx。/home和/home/xxxx的權限都是755。 以上這些帳號都不能ftp登錄,這些都是平常經常使用的,可以用shell登錄的。 我新創建了一個usr1帳號 #useradd-Gtest-d/tmp/usr1usr1 能ftp登錄,他的home為/tmp/usr1,在/分區上。而/home我是mount到/dev/hda9上的。 #mount 所以,我猜想:是否是由于/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.sunshares.net】 |