Guide to Connecting to Your Application Using SSH/SFTP

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

It is a file transfer protocol such as FTP yet operates over a secure network ... on the Cloudways Platform that you can use to connect to your application. AllCollections AdministeringServerandWebsite ConnectingtoApplicationRemotely GuidetoConnectingtoYourApplicationUsingSSH/SFTP GuidetoConnectingtoYourApplicationUsingSSH/SFTP P WrittenbyProductSupport Updatedoveraweekago Therearedifferentwaystoconnecttoyourapplicationremotely,somemoresecurethanothers.TwosecuremethodswhichweliketouseourselvesareSecureShell(SSH),andSecureFileTransferProtocol(SFTP).BothmethodsaresupportedoverallourserverplansincludeSSHandSFTPaccess.VideoTutorial—HowtoConnectviaSSHonWindowsVideoTutorial—HowtoConnectviaSFTPonWindowsWhatisSSH?SecureShellprovidesstrongauthenticationandencrypteddatacommunicationsbetweentwocomputersorserversconnectingoveranopennetworksuchastheinternet.Thismeansthatanydeviceinthemiddleisunabletodecipherthecommunicationbecauseonlyyourenddevice/serverisabletodecrypttheinformationexchange.TipYoucanalsorunadditionaltoolssuchasComposer,Git,WP-CLIforWordPress,anddatabasequeriesusingSSH.WhatisSFTP?SFTPstandsforSecureFileTransferProtocol(alsoknownasSSHFileTransferProtocol).ItisafiletransferprotocolsuchasFTPyetoperatesoverasecurenetworkprotocollikeSSH.WehighlyrecommendusingSFTPforfiletransferringbecause:Itaddsalayerofsecurity.Transferreddataisencrypted,soitisnotsentincleartext.HowtoConnecttoYourApplicationUsingSSH/SFTPPrerequisitesToconnecttoyourserverorapplicationusingSSH,youwillneedthefollowing:MasterusernameorApplicationusername.PasswordPublicIPaddress(alsoknownasServerIP)WewillhelpyoulocatethisinformationonyourCloudwaysPlatforminthenextsteps.PleasenotethattheMasteruserhasSSHaccessenabledbydefault;however,youneedtomanuallyenableSSHaccessfortheapplicationuser(s).SSH/SFTP—AccessingtheCredentialsTherearetwotypesofcredentials(MastercredentialsandApplicationcredentials)ontheCloudwaysPlatformthatyoucanusetoconnecttoyourapplication.Usually,teammembersareprovidedwithapplicationcredentialsbythewebsiteowner.So,whichcredentialswillyoubeusing?ImportantIfyouareusingMicrosoftWindowsyouwilleitherneedtoenableWLS(WindowsLinuxSubsystem)orelseuseafreethird-partytoolsuchasPuTTY.Alternatively,youcanalsousethebuilt-inSSHTerminalofCloudwaysPlatform.YouneedanSFTPclienttoconnecttoyourserverremotely.Inthisdemonstration,weareusingafreethird-partytoolcalledFileZilla,whichisavailableonWindowsandmacOS,butyoucanalsouseanyotherclient.Pleasemakesuretodownloadsuchtoolsonlyfromtheirofficialwebsitetoalwaysgetthelatestavailableversion.UsingMasterCredentialsLogintoyourCloudwaysPlatformusingyouremailaddressandpassword.Fromthetopmenubar,openServers.Then,choosetheserveryouwishtoconnect.3.UnderServerManagement,youcanfindyourPublicIPaddress,username,andpassword.Besuretotakenoteofit.TipClickoncredentialstocopyitontheclipboard.UsingApplicationCredentialsLogintoyourCloudwaysPlatformusingyouremailaddressandpassword.Fromthetopmenubar,openServers.Then,chooseyourserverwhereyourdesiredapplicationisdeployedtoviewapplicationcredentials.3.Next,clickwww.4.Chooseyourdesiredapplication’sname.5.UnderApplicationCredentials,youcanfindyourPublicIPaddress,applicationusername,andpassword.Besuretotakenoteofit.TipClickoncredentialstocopyitontheclipboard.Iftherearenocredentials,thenyoucancreateapplicationcredentials.Below,youwillfindinformationaboutinitiatingconnectionsusingSSHandSFTPseparately.SSH(MicrosoftWindows)—InitiatingConnectionLaunchPuTTYclientandenteryourHostname(ServerPublicIPaddress).InputPort22,whichisalsothestandardTCPportforSSH.ClickOpen.4.YoumayseeanRSA2keypromptifthisisyourfirsttimeconnectingtotheserver.ClickYestomakethisatrustedhostforfutureconnections.SSH(MicrosoftWindows)—LoggingintoServerHere,youneedtoinputyourmasterorapplicationusername,whichyoupreviouslynoted.TipTopastethecopieditemintheterminal,tapright-clickonce.Theterminalscreenwillonlyworkwitharrowkeysfornavigation,notwithamouse.2.Next,inputyourpassword.Pleasenotethatnocharacterwillappearasyoutypethepasswordduetosecurityreasons.3.YouarenowconnectedtoyourserverviaSSH.Now,youcanruncommandssuchaslstolistandnavigateyourfilesanddirectories.ImportantIfyouareusingtheMasterCredentials,youwillneedtobrowsetoyourtargetapplicationfolder.IfyouareusingtheApplicationCredentials,youwilllanddirectlyintherespectiveapplicationfolder.SSH(Linux/macOS)—LoggingintoServerWewon’trequireanyexternalSSHclientforLinux/macOS,althoughyouarefreetodosoifyoualreadyhavesomepreferred3rdpartyapplication.Inthisexample,weareusingLinux(Ubuntu).Openyourterminalandexecutethefollowingcommand.Usernamereferstoamasterusernameorapplicationusername,andthehostnameisyourServerPublicIPaddress.Bydefault,theSSHconnectionisinitiatedusingport22.sshusername@hostExample:[email protected]:youcanalsopointyourSSHclienttowhichprivatekeyshouldbeusedbyusingthe-iidentityswitchasfollows:ssh-i~/.ssh/id_rsamaster_ojnokgldl@192.168.0.1TipTheterminalscreenwillonlyworkwitharrowkeysfornavigation,notwithamouse.2.YoumayseeanRSAkeypromptifthisisyourfirsttimeconnectingtotheserver.Typeyestomakethisatrustedhostforfutureconnections.3.Next,inputyourpassword.Pleasenotethatyourpasswordwillnotbecomevisibleduetosecurityreasons.4.YouarenowconnectedtoyourserverviaSSH.Now,youcanruncommandssuchaslstolistandnavigateyourfilesanddirectories.ImportantIfyouareusingtheMasterCredentials,youwillneedtobrowsetoyourtargetapplicationfolder.IfyouareusingtheApplicationCredentials,youwilllanddirectlyintherespectiveapplicationfolder.PleasenotethatSSHisapotenttool,andadvancedusersuseit.Executingwronginstructionsmaybreakyourwebsiteanddeletethecriticalfiles;therefore,werecommendusingitwithextracareandalwaystakeabackupoftheapplicationyouareworkingonortakeawholeserverbackupalwaystorestoreifneeded.SFTP—InitiatingConnectionLaunchFileZillaclientandentersftp://server-ip-addressinHost.Bywritingsftp://,youareensuringthattheSFTPconnectionisformed.Youneedtoinputyourmasterorapplicationusername,whichyoupreviouslynoted.Next,inputyourpassword.SetPort22.Finally,clickQuickConnect.6.YouarenowconnectedtoyourserverviaSFTP.Now,youcandraganddropfilesandfoldersbetweenyourpersonalcomputerandyourserver.ImportantIfyouareusingtheMasterCredentials,youwillneedtobrowsetoyourtargetapplicationfolder.IfyouareusingtheApplicationCredentials,youwilllanddirectlyintherespectiveapplicationfolder.Ifyoufaceanypermission-relatedissues,thenyoucanalsoresetyourfileandfolderpermissions.That’sit!Wehopethistutorialwashelpful.Ifyouneedanyhelp,thenfeelfreetosearchyourqueryonCloudwaysSupportCenterorcontactusviachat(NeedaHand>SendusaMessage).Alternatively,youcanalsocreateasupportticket. Didthisansweryourquestion?



請為這篇文章評分?