Pulogalamu ya SSH imagwiritsidwa ntchito popereka mauthenga otetezeka ku makompyuta, omwe amalola mphamvu zakutali kuti zisagwiritsidwe ntchito pokhapokha pogwiritsa ntchito makina opangidwira, komanso kudzera mu njira yosakanikirana. Nthawi zina, ogwiritsa ntchito mawonekedwe a Ubuntu ayenera kukhazikitsa seva la SSH pa PC yawo. Choncho, tikukulongosola kuti tidziwitse njirayi mwatsatanetsatane, pokhala tikuphunzira osati njira yokhayo yothandizira, koma komanso kukhazikitsidwa kwa magawo akuluakulu.
Sakani SSH-server ku Ubuntu
Zigawo za SSH zimapezeka kuti zitha kupyolera kudzera mu malo ovomerezeka, chifukwa tidzangoganizira njira yotereyi, ndiyo yodalirika kwambiri komanso yodalirika, ndipo siimayambitsa mavuto kwa ogwiritsa ntchito ntchito. Ife taphwanya ndondomeko yonseyi kuti tipeze njira zochepetsera kuti muzitsatira malangizo. Tiyeni tiyambe kuyambira pachiyambi.
Gawo 1: Koperani ndi kuika SSH-seva
Pangani ntchitoyi idzachitika "Terminal" pogwiritsa ntchito lamulo lalikulu. Sikofunika kukhala ndi chidziwitso kapena maluso ena, mudzalandira tsatanetsatane wa ntchito iliyonse ndi malamulo onse oyenerera.
- Kuthamangitsani console kudzera menyu kapena kugwirizanitsa Ctrl + Alt + T.
- Yambani koperani mafayilo a seva kuchokera ku malo ovomerezeka. Kuti muchite izi, lowani
sudo apt install openssh-server
ndiyeno pezani fungulo Lowani. - Popeza timagwiritsa ntchito chithunzichi sudo (kuchitapo kanthu m'malo mwawonongoleratu), muyenera kulowapo mawu achinsinsi pa akaunti yanu. Onani kuti malembawo sakuwonetsedwa polowa.
- Mudzadziwitsidwa za kuwotcha kwa malemba ena, kutsimikizirani zomwe mukuchita posankha njira D.
- Mwachisawawa, kasitomala aikidwa ndi seva, koma sizingakhale zosasamala kuti zitsimikize kuti zimapezeka pakuyesera kuzibwezeretsa
sudo apt-get install openssh-kasitomala
.
Seva ya SSH idzapezeka kuti izitha kuyanjana nayo nthawi yomweyo mutatha kuwonjezera mafayilo onse kuntchito, koma iyenso ikonzedwe kuti iwonetsetse bwino ntchito. Tikukulangizani kuti mudziwe bwinobwino ndi zotsatirazi.
Gawo 2: Yang'anani ntchito seva
Choyamba, tiyeni tiwonetsetse kuti zoikidwiratu zomwe zilipo zimagwiritsidwa ntchito molondola, ndipo SSH-seva imayankha ku malamulo oyambirira ndikuwatsatira molondola, kotero muyenera:
- Yambani console ndikulembera pamenepo
sudo sitingathe kuthandiza sshd
, kuti muwonjezere seva kuti muyambe Ubuntu, ngati mwadzidzidzi izi sizinachitike pokhapokha mutatha kukhazikitsa. - Ngati simusowa chida choyamba ndi OS, chotsani ku autorun polemba
sudo chitetezo choletsa sshd
. - Tsopano tiyeni tiwone momwe kulumikizana kwa kompyutayo kwakhazikitsidwa. Ikani lamulo
ssh localhost
(localhost - adilesi ya PC yanu). - Tsimikizani kupitiriza kwa kugwirizana mwa kusankha inde.
- Ngati mukuwombola, mudzalandira chinachake chonga ichi, monga momwe mukuwonera pawotchi yotsatira. Onetsetsani kufunikira koyang'ana ku adilesi
0.0.0.0
, zomwe zimasankhidwa kukhala osasinthika pa Intaneti pulogalamu zina. Kuti muchite izi, lowetsani lamulo loyenera ndipo dinani Lowani. - Ndi mgwirizano uliwonse, muyenera kutsimikizira.
Monga mukuonera, lamulo la SSH limagwiritsidwa ntchito kugwirizanitsa makompyuta onse. Ngati mukufuna kugwirizanitsa ndi chipangizo china, ingoyambani chingwechi ndi kulowa mu lamulolossh username @ ip_address
.
Khwerero 3: Sinthani fayilo yosinthika
Zowonjezera zina zonse za SSH protocol zimapangidwa kupyolera mwachinthu chosinthika fayilo posintha zingwe ndi zoyenera. Sitiyang'ana pa mfundo zonse, komanso, ambiri a iwo ali okhaokha kwa aliyense wogwiritsa ntchito, tidzangosonyeza zochita zazikulu.
- Choyamba, sungani kapepala yosungirako fayilo yosinthidwa kuti muipeze kapena kubwezeretsani chikhalidwe choyambirira cha SSH ngati zilizonse. Mu console, lembani lamulo
sudo cp / etc / ssh / sshd_config /etc/ssh/sshd_config.original
. - Kenako chachiwiri:
sudo chmod a-w /etc/ssh/sshd_config.original
. - Kuthamangitsani fayilo yosinthidwa kudutsa
sudo vi / etc / ssh / sshd_config
. Mwamsanga mutangolowa izo zidzayambitsidwa ndipo mudzawona zomwe zili, monga momwe zasonyezera pa skiritsi pansipa. - Pano mungasinthe galimoto yomwe yagwiritsidwa ntchito, yomwe nthawizonse imayenera kuchita kuti muteteze mgwirizano, ndiye kuti kulowetsa m'malo mwachinsinsi (PermitRootLogin) kungakhale kolephereka ndipo PubkeyAuthentication (enabled). Mukamaliza kukonza, dinani makiyiwo : (Shift +; pa chikhodi cha Latin keyboard) ndi kuwonjezera kalata
w
kusunga kusintha. - Kutuluka fayilo kumachitidwa mwanjira yomweyo, m'malo mwake
w
amagwiritsidwa ntchitoq
. - Kumbukirani kukhazikitsanso seva polemba
sudo systemctl kukhazikitsanso ssh
. - Pambuyo kusintha chitukuko chogwira ntchito, muyenera kuchikonza mu kasitomala. Izi zimachitika pofotokoza
ssh -p 2100 lochost
kumene 2100 - chiwerengero cha malo osungirako m'malo. - Ngati muli ndi firewall yokonzedweratu, malo ena amafunikanso pamenepo:
sudo ufw amalola 2100
. - Mudzalandira chidziwitso kuti malamulo onse asinthidwa.
Ndiwe mfulu kuti mudzidziwe nokha ndi magawo ena mwa kuwerenga zolembedwazo. Pali malingaliro othandizira kusintha zinthu zonse kuti muthe kudziwa zomwe mungasankhe nokha.
Gawo 4: Kuwonjezera Keys
Powonjezera makiyi a SSH, chilolezo chimatsegula pakati pa zipangizo ziwiri popanda kufunikira kulembapo mawu achinsinsi. Njira yozindikiritsa imamangidwanso pansi pa ndondomeko yolumikizira chinsinsi chachinsinsi ndi chachinsinsi.
- Tsegulani console ndipo pangani makiyi atsopano achinsinsi polemba
ssh-keygen -ndidas
ndiyeno perekani dzina ku fayilo ndipo tchulani mawu achinsinsi kuti mupeze. - Pambuyo pake, makiyi a anthu adzapulumutsidwa ndipo chithunzi chachinsinsi chidzapangidwa. Pawindo mudzawona maonekedwe ake.
- Ikutsalira kuti mufanizire mafayilo opangidwa ku kompyuta yachiwiri kuti muwononge kugwirizana kudzera muphasiwedi. Gwiritsani ntchito lamulo
Dzina la mtumiki wa ssh-id ndi @ kutalika kwake
kumene dzina la useri @ kutalika - dzina la makompyuta akutali ndi adilesi yake ya IP.
Zimangokhala kukhazikitsa seva ndi kutsimikizira kuti imagwira ntchito molondola kudzera mufungulo la anthu ndi lachinsinsi.
Izi zimatsiriza kukhazikitsa seva ya SSH ndi zosintha zake. Ngati mutalowa malamulo onse molondola, palibe zolakwika zomwe ziyenera kuchitika pakugwira ntchitoyo. Ngati pali mavuto aliwonse ndi kugwirizana mukatha kukhazikitsa, yesani kuchotseratu SSH kuchoka pa auto kuti muthetse vuto (werengani za izo Gawo 2).