vsftpd本地用戶不能登錄問題的解決 |
發(fā)布時(shí)間: 2012/8/11 11:23:53 |
打開/etc/selinux/config
將selinux=enforcing或permissive改成disabled。 記得要重新啟動(dòng)服務(wù)器! 當(dāng)然還要確定以下問題: 1,用戶是否被vsftpd限制登錄,比如用戶名在/etc/ftpusers中,并被阻止登錄了 2,vsftpd.conf中是否打開了pam認(rèn)證的選項(xiàng)(自己編譯安裝的時(shí)候常因?yàn)檫@個(gè)出錯(cuò))(看vsftpd.conf中是否有pam_service_name=ftp或vsftpd.到底是哪個(gè)要看 PAM模塊的服務(wù)文件/etc/pam.d下是誰.我的是ftp且它的配置如下: #%PAM-1.0 3,相關(guān)文件夾的權(quán)限是否正確. 關(guān)于“vsftpd部分本地用戶不能登錄,部分可以”的問題, 系統(tǒng)中原來就有的本地帳號都不能登錄,我的/etc/vsftpd/vsftpd.conf文件的配置如下: local_enable=YES 登錄時(shí)錯(cuò)誤信息都是一樣的: 500OOPS:cannotchangedirectory:/home/xxxx 他們的home目錄都是/home/xxxx。/home和/home/xxxx的權(quán)限都是755。 以上這些帳號都不能ftp登錄,這些都是平常經(jīng)常使用的,可以用shell登錄的。 我新創(chuàng)建了一個(gè)usr1帳號 #useradd-Gtest-d/tmp/usr1usr1 能ftp登錄,他的home為/tmp/usr1,在/分區(qū)上。而/home我是mount到/dev/hda9上的。 #mount 所以,我猜想:是否是由于/home分區(qū)的原因,而造成“主目錄在/home分區(qū)的帳號”都不能登錄呢? 為了驗(yàn)證以上設(shè)想,我試著再創(chuàng)建了一個(gè)帳號 useradd-Gtest-d/home/usr3usr3 /home,/home/usr3的權(quán)限都是755。 usr3ftp登錄失敗。 500OOPS:cannotchangedirectory:/home/usr3 Loginfailed. 421Servicenotavailable,remoteserverhasclosedconnection 至此,我覺得可以確定是由于/home分區(qū)的原因,而造成“主目錄在/home分區(qū)的帳號”都不能登錄。 參考文章: 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.czbl888.cn】 服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM] |