FTP服務(wù)的配置與管理_第1頁(yè)
FTP服務(wù)的配置與管理_第2頁(yè)
FTP服務(wù)的配置與管理_第3頁(yè)
FTP服務(wù)的配置與管理_第4頁(yè)
FTP服務(wù)的配置與管理_第5頁(yè)
已閱讀5頁(yè),還剩7頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

Vsftpd服務(wù)器的配置主要通過修改其主配置文件Vsftpd.conf完成。須要留意的是,更改vsftpd.conf文件后,必需重啟Vsftpd服務(wù)才能使設(shè)置生效。配置vsftpd.conf文件Vsftpd的主配置文件vsftpd.conf位于/etc/書目下。vsftpd.conf文件確定了VsftpdFTP服務(wù)器的主要操作。vsftpd.conf文件由若干配置選項(xiàng)組成,下面介紹其中重要的配置選項(xiàng)。

anonymous_enable=NO/YES是否允許anonymous登錄FTP服務(wù)器,默認(rèn)設(shè)置為YES(允許)。

local_enable=NO/YES是否允許本地用戶登錄FTP服務(wù)器,默認(rèn)設(shè)置為YES(允許)。

write_enable=NO/YES是否允許用戶對(duì)FTP服務(wù)器文件具有寫權(quán)限,默認(rèn)設(shè)置為YES(允許)。

local_umask=022(或者其他值)設(shè)置本地用戶的文件生成掩碼,默認(rèn)值為077,也可以依據(jù)個(gè)人喜好將其設(shè)置為其他值。

anon_upload_enable=NO/YES是否允許匿名用戶上傳文件,默認(rèn)設(shè)置為YES(允許)。

anon_mkdir_write_enable=NO/YES是否允許匿名用戶創(chuàng)建新文件夾。默認(rèn)設(shè)置為YES(允許)。

dirmessage_enable=YES是否激活書目歡迎信息功能,當(dāng)用戶首次訪問服務(wù)器上某個(gè)書目時(shí),F(xiàn)TP服務(wù)器將顯示歡迎信息。默認(rèn)狀況下,歡迎信息是通過書目下的.message文件獲得的。

xferlog_enable=YES是否啟用上傳和下載日志的功能。

ftpd_banner=WelcometoblahFTPservice在FTP服務(wù)器中設(shè)置歡迎登錄信息。當(dāng)用戶登錄到FTP服務(wù)器后,會(huì)看到歡迎信息“WelcometoblahFTPservice”。

chroot_list_enable=NO/YESchroot_list_file=/etc/vsftpd.chroot_list“chroot”是FTP服務(wù)器配置中的重要選項(xiàng)。若“chroot_list_enable”設(shè)置為“YES”,Vsftpd將在“chroot_list_file”選項(xiàng)值的位置找尋chroot_list文件,“/etc/vsftpd.chroot_list”文件中包含的用戶,在登錄后將不能切換到自己書目以外的其他書目,由FTP服務(wù)器自動(dòng)地“chrooted”到用戶自己的home書目下。這將使得chroot_list文件中的用戶不能隨意轉(zhuǎn)到其他用戶的FTPhome書目下,從而有利于FTP服務(wù)器的平安管理和隱私愛護(hù)。

userlist_enable=NO/YESuserlist_deny=NO/YES“userlist_enable”選項(xiàng)默認(rèn)值為“NO”,此時(shí)ftpusers文件中的用戶禁止登錄FTP服務(wù)器。假如userlist_enable設(shè)置為“YES”,則user_list文件中的用戶允許登錄FTP服務(wù)器。而假如同時(shí)設(shè)置了userlist_deny值為“YES”,則user_list文件中的用戶將不允許登錄FTP服務(wù)器。

listen=YES假如設(shè)置為“YES”,則Vsftpd將以獨(dú)立模式運(yùn)行,由Vsftpd自己監(jiān)聽和處理連接懇求。vsftpd/ftpusers與vsfptd/user-list文件配置在/etc/書目下的vsftpd/ftpusers和vsftpd/user-list兩個(gè)文件與主配置文件中的“userlist_enable”和“userlist_deny”選項(xiàng)有著親密聯(lián)系。兩個(gè)文件中,每個(gè)用戶名需占用一行。以下是默認(rèn)狀況下ftpusers文件的內(nèi)容:#Usersthatarenotallowedtologinviaftprootbindaemonadmlpsyncshutdownhaltmailnewsuucpoperatorgamesnobody以下是默認(rèn)狀況下user_list文件的內(nèi)容:#vsftpduserlist#Ifuserlist_deny=NO,onlyallowusersinthisfile#Ifuserlist_deny=YES(default),neverallowusersinthisfile,and#donotevenpromptforapassword.#Notethatthedefaultvsftpdpamconfigalsochecks/etc/vsftpd/ftpusers#forusersthataredenied.rootbindaemonadmlpsyncshutdownhaltmailnewsuucpoperatorgamesnobody比較兩個(gè)文件的內(nèi)容,會(huì)發(fā)覺它們事實(shí)上是一樣的。在運(yùn)用兩個(gè)文件時(shí)的區(qū)分在于,當(dāng)userlist_enable為YES時(shí),假如一個(gè)用戶名在“vsftpd/user_list”文件中,而同時(shí)“userlist_deny”選項(xiàng)為“YES”,則該用戶在試圖登錄FTP服務(wù)器時(shí),將不能夠登錄,甚至連輸入密碼的提示信息都沒有,干脆被FTP服務(wù)器拒絕。而userlist_deny選項(xiàng)和user_list文件一起能夠有效地阻擋“root”、“apache”和“www”等系統(tǒng)用戶登錄FTP服務(wù)器,從而保證了FTP服務(wù)器的分級(jí)平安性。匿名FTP設(shè)置在登錄FTP服務(wù)器的用戶不確定的狀況下,應(yīng)將FTP服務(wù)器設(shè)置為允許匿名賬號(hào)登錄的FTP服務(wù)器。啟用匿名賬號(hào),并對(duì)匿名賬號(hào)服務(wù)進(jìn)行管理是匿名FTP設(shè)置的主要內(nèi)容。1.啟用匿名賬號(hào)啟對(duì)/etc/vsftpd/vsftpd.conf文件做如下修改:anonymous_enable=YESlocal_enable=YESwrite_enable=YESlisten=YES配置好后,須要重新啟動(dòng)Vsftpd。完成上述配置后,Vsftpd將允許匿名賬號(hào)登錄FTP服務(wù)器,允許本地賬號(hào)登錄,同時(shí)允許匿名用戶具有對(duì)FTP服務(wù)器文件的寫權(quán)限,并且只能下載文件而不能上傳。匿名用戶的口令為一個(gè)E-mail地址。測(cè)試的結(jié)果如下:#ftplocalhostConnectedto.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):anonymous331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>ls227EnteringPassiveMode(127,0,0,1,204,140)150Herecomesthedirectorylisting.drwxr-xr-x2004096Jan172007pub226DirectorysendOK.

ftp>cdpub250Directorysuccessfullychanged.ftp>ls227EnteringPassiveMode(127,0,0,1,25,100)150Herecomesthedirectorylisting.-rw-rw-rw-10034Sep1107:48hello.txt226DirectorysendOK.ftp>gethello.txtlocal:hello.txtremote:hello.txt227EnteringPassiveMode(127,0,0,1,181,217)150OpeningBINARYmodedataconnectionforhello.txt(34bytes).226FilesendOK.34bytesreceivedin0.0017seconds(19Kbytes/s)

ftp>!lsbridge.txthello.txtwebalizer.conf

ftp>putwebalizer.conflocal:webalizer.confremote:webalizer.conf227EnteringPassiveMode(127,0,0,1,147,155)550Permissiondenied.ftp>mkdirtest550Permissiondenied.下面對(duì)以上測(cè)試結(jié)果做幾點(diǎn)說明。

Name(localhost:root):anonymous表示用匿名賬號(hào)登錄。

ftp>ls列出匿名賬號(hào)在FTP服務(wù)器上的書目。

ftp>cdpub表示更改書目,進(jìn)入pub文件夾。

ftp>gethello.txt用匿名賬號(hào)下載pub文件夾中的hello.txt文件。

ftp>!lsbridge.txthello.txtwebalizer.conf顯示剛才下載的文件是否已下載到本地。

ftp>putwebalizer.conf匿名賬號(hào)上傳webalizer.conf文件失敗,不允許匿名賬號(hào)上傳文件。

ftp>mkdirtest匿名賬號(hào)創(chuàng)建文件夾失敗,不允許匿名賬號(hào)建立文件夾。2.允許匿名賬號(hào)上傳文件若要允許匿名賬號(hào)上傳文件,須要對(duì)/etc/vsftpd/vsftpd.conf文件做如下修改:anon_upload_enable=YESanon_mkdir_write_enable=YES即把文件中anon_upload_enable=YES和anon_mkdir_write_enable=YES前的“#”去掉,無須修改其他配置。所謂能上傳文件,也就是具有在FTP服務(wù)器的本地書目中新建文件和文件夾的功能。為了測(cè)試上傳文件功能,可以先在/var/ftp書目中建立一個(gè)新書目“test”,并設(shè)置該文件夾具有寫權(quán)限。

創(chuàng)建新書目“test”,如圖11.4所示。

修改test書目的權(quán)限。在“test”上單擊鼠標(biāo)右鍵,并在彈出的快捷菜單中選擇【屬性】吩咐,打開如圖11.5所示的【test屬性】對(duì)話框,選擇【權(quán)限】選項(xiàng)卡,設(shè)置相應(yīng)權(quán)限。將【全部者】設(shè)置為“ftp-FTPUser”,【群組】設(shè)置為“ftp”,并設(shè)置相應(yīng)的【文件夾訪問】、【文件訪問】和【執(zhí)行】權(quán)限。

圖11.4新建“test”書目圖11.5【test屬性】對(duì)話框

重啟Vsftpd服務(wù)測(cè)試的結(jié)果如下:#ftplocalhostConnectedto.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):anonymous331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.

ftp>ls227EnteringPassiveMode(127,0,0,1,68,56)150Herecomesthedirectorylisting.drwxr-xr-x2004096Sep1107:48pubdrwxr-xr-x214504096Sep1108:09test226DirectorysendOK.

ftp>cdtest250Directorysuccessfullychanged.ftp>mkdirincoming257"/test/incoming"createdftp>ls227EnteringPassiveMode(127,0,0,1,107,221)150Herecomesthedirectorylisting.drwx------214504096Sep1108:19incoming226DirectorysendOK.

ftp>!ls1.txtbridge.txthello.txtwebalizer.conf

ftp>put1.txtlocal:1.txtremote:1.txt227EnteringPassiveMode(127,0,0,1,45,47)150Oktosenddata.226FilereceiveOK.361bytessentin0.0018seconds(2e+02Kbytes/s)ftp>ls227EnteringPassiveMode(127,0,0,1,231,175)150Herecomesthedirectorylisting.drwx------214504096Sep1108:19incoming-rw-------11450361Sep1108:241.txt226DirectorysendOK.ftp>下面對(duì)以上測(cè)試結(jié)果做幾點(diǎn)說明。

drwxr-xr-x214504096Sep1108:09testls吩咐后看到前面在pub書目下創(chuàng)建的test書目。

ftp>cdtest更改當(dāng)前書目,進(jìn)入test書目下。

ftp>mkdirincoming257"/test/incoming"created在test書目下創(chuàng)建incoming書目勝利。

ftp>put1.txt將1.txt文件上傳到test書目中。

-rw-------11450361Sep1108:241.txtls吩咐后看到1.txt文件上傳勝利。3.僅允許匿名用戶訪問所謂僅允許匿名用戶訪問,也就是指須要限制本地賬號(hào)訪問,因此須要對(duì)/etc/vsftpd/vsftpd.conf文件做如下修改:#local_enable=YES#write_enable=YES即在文件中l(wèi)ocal_enable=YES和write_enable=YES的前面加上“#”,無須修改其他配置。對(duì)此的測(cè)試結(jié)果如下:#ftplocalhostConnectedto.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):anonymous331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>cdtest250Directorysuccessfullychanged.ftp>bye221Goodbye.

#ftplocalhostConnectedto.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):Kelly530ThisFTPserverisanonymousonly.Loginfailed.ftp>userteacher530ThisFTPserverisanonymousonly.Loginfailed.ftp>userroot530ThisFTPserverisanonymousonly.Loginfailed.從測(cè)試結(jié)果中可以看到,除了anonymous賬號(hào)可以正常登錄外,其他本地賬號(hào)登錄均失敗,服務(wù)器提示“530ThisFTPserverisanonymousonly”,即服務(wù)器僅允許匿名賬號(hào)登錄。4.設(shè)置歡迎信息常用的歡迎信息包括兩種:一種是在登錄FTP服務(wù)器時(shí)顯示的歡迎信息,另一種是在更改書目時(shí)顯示的歡迎信息。歡迎信息的運(yùn)用,能夠讓用戶在訪問FTP服務(wù)器時(shí)感覺到更友好、更親切。

設(shè)置登錄FTP服務(wù)器時(shí)顯示的歡迎信息首先對(duì)/etc/vsftpd/vsftpd.conf文件做如下修改:ftpd_banner=WelcometoblahFTPservice重啟Vsftpd服務(wù)后,測(cè)試結(jié)果如下:#ftplocalhostConnectedto.220WelcometoblahFTPservice.530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):anonymous331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.從測(cè)試結(jié)果中可以看到,在登錄FTP服務(wù)器時(shí),多了一行顯示信息“220WelcometoblahFTPservice”?!癢elcometoblahFTPservice”即在前面為服務(wù)器設(shè)置的歡迎信息,用戶可以依據(jù)須要對(duì)此歡迎信息進(jìn)行修改。

設(shè)置更改書目時(shí)顯示的歡迎信息在須要設(shè)置更改書目歡迎信息的書目下,創(chuàng)建.message文件。例如,在“ftp/test/”書目下新建.message文件,寫入一行文字“Youarewelcome!”,保存后關(guān)閉,如圖11.6所示。圖11.6編輯.message文件內(nèi)容測(cè)試的結(jié)果如下:#ftplocalhostConnectedto.220WelcometoblahFTPservice.530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):anonymous331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>ls227EnteringPassiveMode(127,0,0,1,219,233)150Herecomesthedirectorylisting.drwxr-xr-x2004096Sep1107:48pubdrwxr-xr-x314504096Sep1108:40test226DirectorysendOK.ftp>cdtest250-Youarewelcome!250Directorysuccessfullychanged.可以看到,當(dāng)進(jìn)入“test”書目后,出現(xiàn)“250-Youarewelcome!”這一行歡迎文字。用戶可以依據(jù)須要修改.message文件中的內(nèi)容,以顯示不同的歡迎信息。5.最大傳輸速率設(shè)置最大傳輸速率須要對(duì)/etc/vsftpd/vsftpd.conf文件進(jìn)行修改。例如,設(shè)置匿名用戶的最大傳輸速率為20Kbps,應(yīng)添加如下語(yǔ)句:anon_max_rate=20000再如,設(shè)置本地賬號(hào)最大傳輸率為1Mbps,應(yīng)添加如下語(yǔ)句:local_max_rate=10000006.服務(wù)器最大并發(fā)數(shù)和用戶最大線程數(shù)在/etc/vsftpd/vsftpd.conf文件中添加如下語(yǔ)句:max_clients=99max_per_ip=5即可設(shè)置服務(wù)器允許的最大并發(fā)數(shù)為99,而每個(gè)用戶同一時(shí)段的最大并發(fā)線程數(shù)為5。7.禁止某些IP段的主機(jī)匿名訪問服務(wù)器假如希望限制某些主機(jī)對(duì)FTP服務(wù)器的匿名訪問,可以采納以下方法。

確認(rèn)配置文件/etc/vsftpd/vsftpd.conf中有如下語(yǔ)句:tcp_wrappers=YES該語(yǔ)句表明服務(wù)器運(yùn)用tcp_wrappers作為主機(jī)訪問限制方式。

編輯/etc/hosts.allow文件,增加兩行吩咐:#hosts.allow Thisfiledescribesthenamesofthehostswhichare# allowedtousethelocalINETservices,asdecided# bythe'/usr/sbin/tcpd'server.#vsftpd::DENYvsftpd::DENY表明限制IP為和的主機(jī)訪問IP為的FTP服務(wù)器。在主機(jī)上測(cè)試的結(jié)果如下:MicrosoftWindowsXP[版本5.1.2600](C)版權(quán)全部1985-2001MicrosoftCorp.C:\DocumentsandSettings\Administrator>cd\

Pingingwith32bytesofdata:

Replyfrom:bytes=32time=1msTTL=64Replyfrom:bytes=32time<1msTTL=64Replyfrom:bytes=32time=24msTTL=64Replyfrom:bytes=32time<1msTTL=64

Pingstatisticsfor:Packets:Sent=4,Received=4,Lost=0(0%loss),Approximateroundtriptimesinmilli-seconds:Minimum=0ms,Maximum=24ms,Average=6ms

Connectedto.421Servicenotavailable.Connectionclosedbyremotehost.

運(yùn)用“ping”吩咐時(shí)可以看到,F(xiàn)TP服務(wù)器是可以連通的。然而,通過ftp吩咐對(duì)其進(jìn)行訪問時(shí)則由于被設(shè)置為限制訪問IP,因而無法連接FTP服務(wù)器。8.用ASCII方式傳送數(shù)據(jù)大多數(shù)FTP服務(wù)器都選擇用ASCII方式傳輸數(shù)據(jù),僅須要修改配置文件/etc/vsftpd/vsftpd.conf就能夠?qū)崿F(xiàn)用ASCII方式傳送數(shù)據(jù):ascii_upload_enable=YESascii_download_enable=YES以上語(yǔ)句表明允許運(yùn)用ASCII方式上傳和下載文件。9.設(shè)置數(shù)據(jù)傳輸中斷間隔時(shí)間修改配置文件/etc/vsftpd/vsftpd.conf中的相關(guān)語(yǔ)句如下:idle_session_timeout=600該語(yǔ)句表示空閑的用戶會(huì)話中斷時(shí)間為600秒,也就是當(dāng)數(shù)據(jù)傳輸結(jié)束后,用戶連接FTP服務(wù)器的時(shí)間不應(yīng)超過600秒。可以依據(jù)實(shí)際狀況對(duì)該值進(jìn)行修改。data_connection_timeout=120該語(yǔ)句表示數(shù)據(jù)連接超時(shí)時(shí)間為120秒,也可以依據(jù)實(shí)際狀況對(duì)其進(jìn)行修改。真實(shí)賬號(hào)設(shè)置對(duì)真實(shí)賬號(hào)訪問FTP服務(wù)器的設(shè)置,主要也是修改配置文件/etc/vsftpd/vsftpd.conf。在前面匿名賬號(hào)設(shè)置中提到的一些配置,在真實(shí)賬號(hào)的設(shè)置中也是同樣可用的,因此不再贅述。此處主要說明的是與真實(shí)賬號(hào)有關(guān)的訪問限制設(shè)置。在進(jìn)行設(shè)置和測(cè)試前,應(yīng)新建幾個(gè)用戶。選擇【系統(tǒng)】|【管理】中的【用戶和群組】選項(xiàng),打開【用戶管理者】對(duì)話框,新建名為“user1”、“user2”和“user3”的三個(gè)用戶。然后將user1添加至/etc/vsftpd/ftpusers文件中,將user2添加至/etc/vsftpd/user_list文件中,而user3則不用添加到這兩個(gè)文件中。1.運(yùn)用用戶列表進(jìn)行訪問限制

ftpusers文件中的用戶不行以訪問FTP服務(wù)器設(shè)置語(yǔ)句如下:userlist_enable=NOuserlist_enable選項(xiàng)的默認(rèn)值為“NO”,當(dāng)/etc/vsftpd/vsftpd.conf文件中出現(xiàn)該語(yǔ)句時(shí),ftpusers文件中的用戶將被禁止訪問FTP服務(wù)器。因此,ftpusers文件又被稱為“禁止運(yùn)用Vsftpd的用戶列表文件”。測(cè)試的結(jié)果如下:#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user1331Pleasespecifythepassword.Password:530Loginincorrect.Loginfailed.ftp>bye221Goodbye.

#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user2331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>bye221Goodbye.

#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user3331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>

僅允許user_list中的用戶訪問服務(wù)器設(shè)置語(yǔ)句如下:userlist_enable=YESuserlist_deny=NO當(dāng)userlist_enable設(shè)置為YES,而userlist_deny設(shè)置為NO時(shí),F(xiàn)TP服務(wù)器僅允許user_list中的用戶訪問。測(cè)試結(jié)果如下:#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user1530Permissiondenied.Loginfailed.ftp>bye221Goodbye.

#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user2331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>bye221Goodbye.

#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user3530Permissiondenied.Loginfailed.ftp>可以看到,user2位于user_list文件中,因此,只有user2能夠正常登錄FTP服務(wù)器,user1和user3均不能訪問。

ftpusers和user_list文件中的用戶均不能訪問FTP服務(wù)器設(shè)置語(yǔ)句如下:userlist_enable=YESuserlist_deny=YES測(cè)試結(jié)果如下:#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user1331Pleasespecifythepassword.Password:530Loginincorrect.Loginfailed.ftp>bye221Goodbye.

#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user2530Permissiondenied.Loginfailed.ftp>bye221Goodbye.

#ftplocalhostConnectedtolocalhost.localdomain.220(vsFTPd)530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):user3331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>從測(cè)試結(jié)果可以看出,user1和user2均不能登錄FTP服務(wù)器,只有user3可以正常登錄。而user1和user2在登錄時(shí)的狀況也是不同的。位于ftpusers文件中的user1,登錄時(shí)出現(xiàn)了要求輸入密碼的提示信息,輸入密碼后服務(wù)器響應(yīng)為訪問被拒絕;而位于user_list中的user2,在登錄時(shí)干脆被拒絕,沒有要求輸入密碼的提示信息。從上述測(cè)試中可以看出,Vsftpd服務(wù)器可以通過在/etc/vsftpd/vsftpd.conf文件中設(shè)置userlist_enable和userlist_deny的值實(shí)現(xiàn)對(duì)不同用戶的訪問限制。2.設(shè)置用戶組通過用戶組方式訪問FTP服務(wù)器,能夠進(jìn)一步增加FTP服務(wù)器的平安性。為完成用戶組的設(shè)置并進(jìn)行測(cè)試,首先在/home書目下創(chuàng)建“try”書目,作為群組用戶的主書目??梢酝ㄟ^選擇【系統(tǒng)】|【管理】中的【用戶和群組】選項(xiàng),打開【用戶管理器】對(duì)話框來設(shè)置用戶和群組。選擇【添加組群】按鈕,在【創(chuàng)建新組群】對(duì)話框中創(chuàng)建群組“try”即可,如圖11.7所示。完成創(chuàng)建群組的操作后,單擊【添加用戶】按鈕,在如圖11.8所示的【創(chuàng)建新用戶】對(duì)話框中,分別創(chuàng)建try1、try2和try3三個(gè)用戶。

圖11.7創(chuàng)建群組“try”圖11.8【創(chuàng)建新用戶】對(duì)話框須要留意的是,在創(chuàng)建新用戶時(shí),不要選中對(duì)話框中【創(chuàng)建主書目】和【為該用戶創(chuàng)建私人組群】復(fù)選框。創(chuàng)建完成后,雙擊用戶名打開如圖11.9所示的【用戶屬性】對(duì)話框,分別設(shè)置三個(gè)用戶的【用戶數(shù)據(jù)】和【組群】選項(xiàng)卡。在【用戶數(shù)據(jù)】選項(xiàng)卡中,將三個(gè)用戶的【主書目】設(shè)置為“/home/try”。在如圖11.10所示的【組群】選項(xiàng)卡中,將三個(gè)用戶加入到“try”組群中,即選中“try”組群前的復(fù)選框。最終,還須要對(duì)/home/try書目的屬性進(jìn)行設(shè)置。在該書目的【try屬性】對(duì)話框中,選擇【權(quán)限】選項(xiàng)卡,將“try”書目的全部者設(shè)置為用戶“try1”,“try1”對(duì)書目具有讀、寫和執(zhí)行的權(quán)限。將“try”書目的群組設(shè)置為群組“try”,并將群組“try”對(duì)該書目的權(quán)限設(shè)置為讀和執(zhí)行,如圖11.11所示。

圖11.9【用戶屬性】對(duì)話框圖11.10【組群】選項(xiàng)卡圖11.11【權(quán)限】選項(xiàng)卡設(shè)置完成設(shè)置后,群組“try”中三個(gè)用戶對(duì)/home/try文件夾擁有的權(quán)限如下。

try1:讀、寫、執(zhí)行

try2、try3:讀、執(zhí)行接下來通過吩咐測(cè)試群組方式訪問FTP服務(wù)器的結(jié)果。具有讀、寫和執(zhí)行權(quán)限的書目全部者,能夠?qū)崿F(xiàn)閱讀、下載、上傳及創(chuàng)建書目和文件的操作;而在群組中僅具有讀和執(zhí)行權(quán)限的用戶,只能完成閱讀和下載操作。測(cè)試結(jié)果如下:#ftplocalhostConnectedto.220WelcometoblahFTPservice.530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):try1331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>ls227EnteringPassiveMode(127,0,0,1,215,117)150Herecomesthedirectorylisting.226DirectorysendOK.ftp>mkdirnew257"/new"createdftp>ls227EnteringPassiveMode(127,0,0,1,163,211)150Herecomesthedirectorylisting.drwxr-xr-x25071004096Sep1111:12new226DirectorysendOK.ftp>!lshello.txtftp>puthello.txtlocal:hello.txtremote:hello.txt227EnteringPassiveMode(127,0,0,1,176,127)150Oktosenddata.226FilereceiveOK.367bytessentin0.00029seconds(1.2e+03Kbytes/s)ftp>ls227EnteringPassiveMode(127,0,0,1,210,143)150Herecomesthedirectorylisting.drwxr-xr-x25071004096Sep1111:12new-rw-r--r--1507100367Sep1111:13hello.txt226DirectorysendOK.ftp>bye221Goodbye.

#ftplocalhostConnectedto.220WelcometoblahFTPservice.530PleaseloginwithUSERandPASS.530PleaseloginwithUSERandPASS.KERBEROS_V4rejectedasanauthenticationtypeName(localhost:root):try2331Pleasespecifythepassword.Password:230Loginsuccessful.RemotesystemtypeisUNIX.Usingbinarymodetotransferfiles.ftp>ls227EnteringPassiveMode(127,0,0,1,84,106)150Herecomesthedirectorylisting.drwxr-xr-x25071004096Sep1111:12new-rw-r--r--1507100367Sep1111:13hello.txt226Directoryse

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論