Faka iseva ye-SSH ku-Ubuntu

Pin
Send
Share
Send

Iphrothokholi ye-SSH isetshenziselwa ukuhlinzeka ukuxhumana okuvikelekile kwikhompyutha, okuvumela ukulawulwa kude hhayi nje ngegobolondo lohlelo lokusebenza, kepha nangesiteshi esifihliwe. Kwesinye isikhathi abasebenzisi bohlelo lokusebenza lobuntu banesidingo sokubeka iseva ye-SSH kwi-PC yabo nganoma iyiphi injongo. Ngakho-ke, siphakamisa ukuthi uzijwayeze le nqubo ngokuningiliziwe, njengoba ungafundanga inqubo yokulayisha kuphela, kodwa futhi nokucushwa kwamapharamitha amakhulu.

Faka iseva ye-SSH ku-Ubuntu

Izakhi ze-SSH ziyatholakala ukuze zilandwe ngokufakwa okusemthethweni, ngoba sizocubungula nje indlela enjalo, yiyona ezinzile kakhulu futhi ethembekile, futhi futhi ayibangeli ubunzima kubasebenzisi be-novice. Sihlukanise yonke inqubo yaba yizinyathelo, ukuze kube lula kuwe ukuthola imiyalo. Ake siqale kusukela ekuqaleni.

Isinyathelo 1: Landa futhi ufake i-SSH-server

Sizokwenza umsebenzi ngokusebenzisa "Isiginali" usebenzisa iqoqo lemiyalo eyisisekelo. Awudingi ukuba nolwazi olwengeziwe noma amakhono, uzothola incazelo eningilizayo yesenzo ngasinye nayo yonke imiyalo edingekayo.

  1. Hola ikhonsoli ngemenyu noma ubambe inhlanganisela I-Ctrl + Alt + T.
  2. Ngokushesha qala ukulanda amafayela e-server kusuka endaweni esemthethweni. Ukuze wenze lokhu, ngenaukufaka i-sudo apt ukufaka i-opensh-serverbese ucindezela ukhiye Ngena.
  3. Kusukela sisebenzisa isiqalo sudo (Ukwenza isenzo egameni le-superuser), uzodinga ukufaka iphasiwedi ye-akhawunti yakho. Qaphela ukuthi izinhlamvu aziboniswa ngesikhathi sokufakwa.
  4. Uzokwaziswa ngokulanda ivolumu ethile yezinqolobane, qinisekisa isenzo ngokukhetha D.
  5. Ngokuzenzakalelayo, iklayenti ifakiwe neseva, kepha ngeke kube yinto ephezulu yokuqinisekisa ubukhona bayo ngokuzama ukuyifaka futhisudo apt-get ukufaka opensh-iklayenti.

Iseva ye-SSH izotholakala ngokuxhumana nayo ngokushesha ngemuva kokufakwa ngempumelelo kwamafayela ohlelweni lokusebenza, kepha isadinga ukulungiswa ukuze kuqinisekiswe ukusebenza okuyiyo. Sincoma ukuthi uzijwayeze ngezinyathelo ezilandelayo.

Isinyathelo 2: Qinisekisa Ukusebenza Kweseva

Okokuqala, masiqinisekise ukuthi amapharamitha ajwayelekile asetshenziswe kahle, kanti iseva ye-SSH iphendula imiyalo eyisisekelo futhi iyenze kahle, ngakho-ke udinga:

  1. Hola ikhonsoli bese ubhala laphosudo systemctl inika amandla i-sshdukufaka iseva kokuqala kobuntu uma lokhu kungenzeki ngokuzenzakalelayo ngemuva kokufakwa.
  2. Uma ungadingi ithuluzi ukuze uqale nge-OS, lisuse ku-autorun ngokungenasudo systemctl khubaza sshd.
  3. Manje ake sibheke ukuthi ukuxhumana kwikhompyutha yasendaweni kwenziwa kanjani. Faka isicelossh kwasendaweni(indawo yasekhaya ikheli le-PC yakho yasendaweni).
  4. Qinisekisa ukuxhumeka okuqhubekayo ngokukhetha yebo.
  5. Endabeni yokulayishwa okuphumelela, uzokwamukela cishe imininingwane efanayo njengoba ubona ku-skrini elandelayo. Bheka kudingekile nokuxhumeka ekhelini0.0.0.0, esebenza njenge-IP ekhethiwe yenethiwekhi yokuzenzakalelayo kwamanye amadivaysi. Ukuze wenze lokhu, faka umyalo ofanele bese uqhafaza kuwo Ngena.
  6. Ngokuxhumana okusha ngakunye, kuzodingeka ukukuqinisekisa.

Njengoba ukwazi ukubona, umyalo we-ssh usetshenziselwa ukuxhuma kunoma iyiphi ikhompyutha. Uma udinga ukuxhuma kwenye idivaysi, vele uqalise ukugcina bese ufaka umyalo ngefomethiigama lomsebenzisi le-ssh @ ip_address.

Isinyathelo 3: Ukuhlela ifayela lokucushwa

Zonke ezinye izilungiselelo zephrothokholi ye-SSH zenziwa ngefayela elikhethekile lokucushwa ngokuguqula imigqa namavelu. Ngeke sigxile kuwo wonke amaphuzu, ngaphezu kwalokho, iningi lawo lingamuntu ngamunye kumsebenzisi ngamunye, sizokhombisa kuphela imisebenzi eyinhloko.

  1. Okokuqala, gcina ikhophi eliyisipele lefayela lokucushwa ukuze uma kwenzeka ufinyelela okuthile noma ubuyisele isimo sokuqala se-SSH. Namathisela umyalo ku-consolesudo cp / etc / ssh / sshd_config /etc/ssh/sshd_config.original.
  2. Bese kuthi owesibili:sudo chmod a-w /etc/ssh/sshd_config.original.
  3. Ifayela lezilungiselelo liqaliswa ngokusebenzisasudo vi / etc / ssh / sshd_config. Masinyane nje ngemuva kokukufaka, kuzokwethulwa futhi uzobona okukulo, njengoba kukhonjiswe esithombeni esingezansi.
  4. Lapha ungashintsha imbobo elisetshenzisiwe, elihlala lenziwa kangcono ukuqinisekisa ukuphepha koxhumano, bese ungene ngemvume egameni le-superuser (PermitRootLogin) lingakhutshazwa futhi kusebenze ngokwenza ukhiye (i-PubkeyAuthentication) inikwe amandla. Lapho uqeda ukuhlela, cindezela inkinobho : (I-Shift + ngesakhiwo sesiLatini) bese ufaka incwadiwukusindisa izinguquko.
  5. Ukuphuma kwifayela kwenziwa ngendlela efanayo, kepha esikhundleniwisetshenzisiweq.
  6. Khumbula ukuqala kabusha iseva ngokuthayiphasudo systemctl qala kabusha ssh.
  7. Ngemuva kokushintsha imbobo esebenzayo, udinga ukuyilungisa kwikhasimende. Lokhu kwenziwa ngokubalulassh -p 2100 i-localhostkuphi 2100 - Inombolo echwebeni entsha.
  8. Uma une-firewall elungiselelwe, kudinga nokubuyiselwa okunye:sudo ufw vumela 2100.
  9. Uzothola isaziso sokuthi yonke imithetho ibuyekeziwe.

Ungazijwayeza amanye ama-parameter ngokufunda amadokhumenti asemthethweni. Kunezeluleko zokushintsha zonke izinto ukusiza ukucacisa ukuthi yimaphi amanani okufanele uzikhethele wona.

Isinyathelo 4: Ukungeza Okhiye

Lapho kwenezelwa okhiye be-SSH, ukugunyazwa phakathi kwamadivayisi amabili kuvula ngaphandle kwesidingo se-password. Inqubo yokuhlonza yakhiwa ngaphansi kwe-algorithm yokufunda ukhiye oyimfihlo nowomphakathi.

  1. Vula ikhonsoli bese udala ukhiye omusha weklayenti ngokungenassh-keygen -t dsa, bese ubeka igama lefayela bese ucacisa iphasiwedi yokufinyelela.
  2. Ngemuva kwalokho, ukhiye womphakathi uzosindiswa bese kudalwa isithombe esiyimfihlo. Esikrinini uzobona ukubukwa kwayo.
  3. Kuhlala kuphela ukukopisha ifayela elakhiwe kwikhompyuter yesibili ukukhipha ukuxhumana ngephasiwedi. Sebenzisa umyaloigama lomsebenzisi le-ssh-copy-idkuphi igama lomsebenzisi @ kudehost - Igama lekhompyutha elikude nekheli lakhona le-IP.

Kuhlala kuphela kabusha iseva futhi iqinisekise ukusebenza kwayo okuyikho ngokusebenzisa izinkinobho zomphakathi nezimfihlo.

Lokhu kuqeda ukufakwa kweseva ye-SSH nokulungiswa kwayo okuyisisekelo. Uma ufaka yonke imiyalo kahle, akukho maphutha okufanele avele phakathi nomsebenzi. Uma kwenzeka kunezinkinga zokuxhumeka ngemuva kokucushwa, zama ukususa i-SSH ekuqaleni ukuze uxazulule inkinga (funda ngakho ngaphakathi Isinyathelo 2).

Pin
Send
Share
Send