始創(chuàng)于2000年 股票代碼:831685
咨詢熱線:0371-60135900 注冊有禮 登錄
  • 掛牌上市企業(yè)
  • 60秒人工響應(yīng)
  • 99.99%連通率
  • 7*24h人工
  • 故障100倍補(bǔ)償
全部產(chǎn)品
您的位置: 網(wǎng)站首頁 > 幫助中心>文章內(nèi)容

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
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,相關(guān)文件夾的權(quán)限是否正確.

關(guān)于“vsftpd部分本地用戶不能登錄,部分可以”的問題,

系統(tǒng)中原來就有的本地帳號都不能登錄,我的/etc/vsftpd/vsftpd.conf文件的配置如下:

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

登錄時(shí)錯(cuò)誤信息都是一樣的:

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

他們的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
/dev/hdb1on/typeext3(rw)
/dev/hda9on/hometypeext2(rw)

所以,我猜想:是否是由于/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]

  • 您可能在找
  • 億恩北京公司:
  • 經(jīng)營性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經(jīng)營性ICP/ISP/IDC證:豫B1.B2-20060070
  • 億恩南昌公司:
  • 經(jīng)營性ICP/ISP證:贛B2-20080012
  • 服務(wù)器/云主機(jī) 24小時(shí)售后服務(wù)電話:0371-60135900
  • 虛擬主機(jī)/智能建站 24小時(shí)售后服務(wù)電話:0371-60135900
  • 專注服務(wù)器托管17年
    掃掃關(guān)注-微信公眾號
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權(quán)所有  地址:鄭州市高新區(qū)翠竹街1號總部企業(yè)基地億恩大廈  法律顧問:河南亞太人律師事務(wù)所郝建鋒、杜慧月律師   京公網(wǎng)安備41019702002023號
      0
     
     
     
     

    0371-60135900
    7*24小時(shí)客服服務(wù)熱線