FTP Anonymous Authentication <anonymousAuthentication>

文章推薦指數: 80 %
投票人數:10人

Anonymous users will typically log in by using a user name of ftp or anonymous, and most users will use their e-mail address as a password, ... Skiptomaincontent Thisbrowserisnolongersupported. UpgradetoMicrosoftEdgetotakeadvantageofthelatestfeatures,securityupdates,andtechnicalsupport. DownloadMicrosoftEdge Moreinfo Tableofcontents Exitfocusmode ReadinEnglish Save Tableofcontents ReadinEnglish Save Edit Twitter LinkedIn Facebook Email Tableofcontents FTPAnonymousAuthentication Article 03/21/2022 11minutestoread 5contributors Isthispagehelpful? Yes No Anyadditionalfeedback? FeedbackwillbesenttoMicrosoft:Bypressingthesubmitbutton,yourfeedbackwillbeusedtoimproveMicrosoftproductsandservices.Privacypolicy. Submit Thankyou. Inthisarticle Overview Theelementspecifiesthesettingsforanonymousaccess.ThisformofauthenticationallowsaccesstoanFTPsitewithoutauseraccountonyourserverordomain,andismostoftenusedforpublicFTPsites. Anonymoususerswilltypicallyloginbyusingausernameofftporanonymous,andmostuserswillusetheire-mailaddressasapassword,althoughthisisnotrequired. Compatibility Version Notes IIS10.0 TheelementwasnotmodifiedinIIS10.0. IIS8.5 TheelementwasnotmodifiedinIIS8.5. IIS8.0 TheelementwasnotmodifiedinIIS8.0. IIS7.5 TheelementoftheelementshipsasafeatureofIIS7.5. IIS7.0 TheelementoftheelementwasintroducedinFTP7.0,whichwasaseparatedownloadforIIS7.0. IIS6.0 TheelementanditschildelementsreplacetheIIS6.0FTPsettingsthatwerelocatedintheLM/MSFTPSVCmetabasepath. Note TheFTP7.0andFTP7.5servicesshippedout-of-bandforIIS7.0,whichrequireddownloadingandinstallingthemodulesfromthefollowingURL: https://www.iis.net/expand/FTP WithWindows7andWindowsServer2008R2,theFTP7.5serviceshipsasafeatureforIIS7.5,sodownloadingtheFTPserviceisnolongernecessary. Setup TosupportFTPpublishingforyourWebserver,youmustinstalltheFTPservice.Todoso,usethefollowingsteps. WindowsServer2012orWindowsServer2012R2 Onthetaskbar,clickServerManager. InServerManager,clicktheManagemenu,andthenclickAddRolesandFeatures. IntheAddRolesandFeatureswizard,clickNext.SelecttheinstallationtypeandclickNext.SelectthedestinationserverandclickNext. OntheServerRolespage,expandWebServer(IIS),andthenselectFTPServer. Note TosupportASP.MembershipauthenticationorIISManagerauthenticationfortheFTPservice,youwillneedtoselectFTPExtensibility,inadditiontoFTPService. . ClickNext,andthenontheSelectfeaturespage,clickNextagain. OntheConfirminstallationselectionspage,clickInstall. OntheResultspage,clickClose. Windows8orWindows8.1 OntheStartscreen,movethepointerallthewaytothelowerleftcorner,right-clicktheStartbutton,andthenclickControlPanel. InControlPanel,clickProgramsandFeatures,andthenclickTurnWindowsfeaturesonoroff. ExpandInternetInformationServices,andthenselectFTPServer. Note TosupportASP.MembershipauthenticationorIISManagerauthenticationfortheFTPservice,youwillalsoneedtoselectFTPExtensibility. ClickOK. ClickClose. WindowsServer2008R2 Onthetaskbar,clickStart,pointtoAdministrativeTools,andthenclickServerManager. IntheServerManagerhierarchypane,expandRoles,andthenclickWebServer(IIS). IntheWebServer(IIS)pane,scrolltotheRoleServicessection,andthenclickAddRoleServices. OntheSelectRoleServicespageoftheAddRoleServicesWizard,expandFTPServer. SelectFTPService. Note TosupportASP.MembershipauthenticationorIISManagerauthenticationfortheFTPservice,youwillalsoneedtoselectFTPExtensibility. ClickNext. OntheConfirmInstallationSelectionspage,clickInstall. OntheResultspage,clickClose. Windows7 Onthetaskbar,clickStart,andthenclickControlPanel. InControlPanel,clickProgramsandFeatures,andthenclickTurnWindowsFeaturesonoroff. ExpandInternetInformationServices,andthenFTPServer. SelectFTPService. Note TosupportASP.MembershipauthenticationorIISManagerauthenticationfortheFTPservice,youwillalsoneedtoselectFTPExtensibility. ClickOK. WindowsServer2008orWindowsVista DownloadtheinstallationpackagefromthefollowingURL: https://www.iis.net/expand/FTP FollowtheinstructionsinthefollowingwalkthroughtoinstalltheFTPservice: InstallingandTroubleshootingFTP7 HowTo HowtoenableordisableAnonymousauthenticationforanFTPsite OpenInternetInformationServices(IIS)Manager: IfyouareusingWindowsServer2012orWindowsServer2012R2: Onthetaskbar,clickServerManager,clickTools,andthenclickInternetInformationServices(IIS)Manager. IfyouareusingWindows8orWindows8.1: HolddowntheWindowskey,presstheletterX,andthenclickControlPanel. ClickAdministrativeTools,andthendouble-clickInternetInformationServices(IIS)Manager. IfyouareusingWindowsServer2008orWindowsServer2008R2: Onthetaskbar,clickStart,pointtoAdministrativeTools,andthenclickInternetInformationServices(IIS)Manager. IfyouareusingWindowsVistaorWindows7: Onthetaskbar,clickStart,andthenclickControlPanel. Double-clickAdministrativeTools,andthendouble-clickInternetInformationServices(IIS)Manager. IntheConnectionspane,expandtheservername,expandtheSitesnode,andthenclickthenameofthesite. Inthesite'sHomepane,double-clicktheFTPAuthenticationfeature. OntheFTPAuthenticationpage,selectAnonymousAuthentication. IntheActionspane,clickEnabletoenableAnonymousauthenticationorclickDisabletodisableAnonymousauthentication. HowtousetheFTPSiteWizardtoCreateanFTPSitewithAnonymousReadAccess OpenInternetInformationServices(IIS)Manager: IfyouareusingWindowsServer2012orWindowsServer2012R2: Onthetaskbar,clickServerManager,clickTools,andthenclickInternetInformationServices(IIS)Manager. IfyouareusingWindows8orWindows8.1: HolddowntheWindowskey,presstheletterX,andthenclickControlPanel. ClickAdministrativeTools,andthendouble-clickInternetInformationServices(IIS)Manager. IfyouareusingWindowsServer2008orWindowsServer2008R2: Onthetaskbar,clickStart,pointtoAdministrativeTools,andthenclickInternetInformationServices(IIS)Manager. IfyouareusingWindowsVistaorWindows7: Onthetaskbar,clickStart,andthenclickControlPanel. Double-clickAdministrativeTools,andthendouble-clickInternetInformationServices(IIS)Manager. IntheConnectionspane,clicktheSitesnodeinthetree. Right-clicktheSitesnodeinthetreeandclickAddFTPSite,orclickAddFTPSiteintheActionspane. WhentheAddFTPSitewizardappears: Enter"MyNewFTPSite"intheFTPsitenamebox. ForthePhysicalpathbox,youcanuseoneofthefollowingoptionstospecifyyourcontentdirectory: Clicktheellipsis(...)button,andthennavigatetothefolderthatcontainsthecontentforyourFTPsite. Typeinthepathtoyourcontentfolderinthebox.Notethatifyouchoosetotypethepath,youcanuseenvironmentvariablesinyourpaths.Forexample,youcanuse"%SystemDrive%\inetpub\ftproot"foryourcontentdirectory. Whenyouhavecompletedtheseitems,clickNext. OnthesecondpageoftheAddFTPSitewizard: ChooseanIPaddressforyourFTPsitefromtheIPAddressdrop-down,orchoosetoacceptthedefaultselectionof"AllUnassigned." EntertheTCP/IPportfortheFTPsiteinthePortbox.Bydefault,FTPsitesandclientsuseport21.(Note:TospecifyImplicitFTPS,youneedtouseport990.) TouseanFTPvirtualhostname,selecttheboxforEnableVirtualHostNames,thenenterthevirtualhostnameintheVirtualHostbox. FortheSSLoptions,chooseoneofthefollowingoptions: SelectNoSSLtodisabletheSSLoptions. SelectAllowSSLtoallowFTPclientstooptionallyuseFTPoverSSLwhentheyconnectwiththeFTPserver. SelectRequireSSLtoallowFTPclientstoalwaysuseFTPoverSSLwhentheyconnectwiththeFTPserver. IfyouchooseAllowSSLorRequireSSL,chooseacertificatefromtheSSLCertificatedrop-downmenu. Whenyouhavecompletedtheseitems,clickNext. Onthenextpageofthewizard: SelectAnonymousfortheAuthenticationsettings. FortheAuthorizationsettings,choose"Anonymoususers"fromtheAllowaccesstodrop-down. SelectReadforthePermissionsoption. Whenyouhavecompletedtheseitems,clickFinish. Configuration Theelementisconfiguredatthesitelevel. Attributes Attribute Description defaultLogonDomain Optionalstringattribute.Specifiesthedefaultdomainforanonymoususeraccountlookups.ThedefaultvalueisNTAUTHORITY. enabled OptionalBooleanattribute.SpecifieswhetherAnonymousauthenticationisenabled.Thedefaultvalueisfalse. logonMethod Optionalenumattribute.SpecifiesthelogontypefortheanonymoususerasinterpretedbyLogonUserWin32API.ValueDescriptionInteractiveSpecifiestheinteractivelogontype.Thenumericvalueis0.BatchSpecifiesthebatchlogontype.Thenumericvalueis1.NetworkSpecifiesthenetworklogontype.Thenumericvalueis2.ClearTextSpecifiesthecleartextlogontype.Thenumericvalueis3.ThedefaultvalueisClearText. password Optionalstringattribute.Specifiesthepasswordfortheanonymoususeraccount.Thereisnodefaultvalue. userName Optionalstringattribute.Specifiestheusernamefortheanonymoususeraccount.ThedefaultvalueisIUSR. ChildElements None. ConfigurationSample ThefollowingsampleillustratesseveralconfigurationsettingsintheelementforanFTPsite.Morespecifically,thesettingsinthisexampledemonstratehowto: CreateanFTPsiteandaddthebindingfortheFTPprotocolonport21. ConfiguretheFTPSSLoptionstoallowsecureaccessonboththecontrolanddatachannelusingacertificate. DisableAnonymousauthenticationandenableBasicauthenticationforFTP. DenyaccessforFTPSYSTcommand. SpecifytheUNIXdirectorylistingformat. Configuretheloggingoptions. Specifyacustomizedwelcomemessageandenablelocaldetailederrormessages. Specifythatuserswillstartinahomedirectorythatisbasedontheirloginname,butonlyifthatdirectoryexists. SampleCode ThefollowingexamplesenableAnonymousauthenticationforanFTPsitewiththepasswordattributesetto"PW",andtheuserNameattributesetto"AUSR". AppCmd.exe appcmd.exesetconfig-section:system.applicationHost/sites/[name='ftp.example.com'].ftpServer.security.authentication.anonymousAuthentication.enabled:"TRUE"/commit:apphost appcmd.exesetconfig-section:system.applicationHost/sites/[name='ftp.example.com'].ftpServer.security.authentication.anonymousAuthentication.password:"PW"/commit:apphost appcmd.exesetconfig-section:system.applicationHost/sites/[name='ftp.example.com'].ftpServer.security.authentication.anonymousAuthentication.userName:"AUSR"/commit:apphost Note YoumustbesuretosetthecommitparametertoapphostwhenyouuseAppCmd.exetoconfigurethesesettings.ThiscommitstheconfigurationsettingstotheappropriatelocationsectionintheApplicationHost.configfile. C# usingSystem; usingSystem.Text; usingMicrosoft.Web.Administration; internalstaticclassSample { privatestaticvoidMain() { using(ServerManagerserverManager=newServerManager()) { Configurationconfig=serverManager.GetApplicationHostConfiguration(); ConfigurationSectionsitesSection=config.GetSection("system.applicationHost/sites"); ConfigurationElementCollectionsitesCollection=sitesSection.GetCollection(); ConfigurationElementsiteElement=FindElement(sitesCollection,"site","name",@"ftp.example.com"); if(siteElement==null)thrownewInvalidOperationException("Elementnotfound!"); ConfigurationElementftpServerElement=siteElement.GetChildElement("ftpServer"); ConfigurationElementsecurityElement=ftpServerElement.GetChildElement("security"); ConfigurationElementauthenticationElement=securityElement.GetChildElement("authentication"); ConfigurationElementanonymousAuthenticationElement=authenticationElement.GetChildElement("anonymousAuthentication"); anonymousAuthenticationElement["enabled"]=true; anonymousAuthenticationElement["password"]="PW"; anonymousAuthenticationElement["userName"]="AUSR"; serverManager.CommitChanges(); } } privatestaticConfigurationElementFindElement(ConfigurationElementCollectioncollection,stringelementTagName,paramsstring[]keyValues) { foreach(ConfigurationElementelementincollection) { if(String.Equals(element.ElementTagName,elementTagName,StringComparison.OrdinalIgnoreCase)) { boolmatches=true; for(inti=0;i



請為這篇文章評分?