Ukufaka iSSH-server ku-Ubuntu

I-protocol ye-SSH isetshenziselwa ukuhlinzeka ukuxhumeka okuphephile kwikhompyutha, evumela ukulawula okukude hhayi kuphela nge-shell system yokusebenza, kodwa futhi ngesiteshi sokubethela. Ngezinye izikhathi, abasebenzisi besistimu yokusebenza ye-Ubuntu kudingeka bafake iseva ye-SSH kwi-PC yabo nganoma iyiphi injongo. Ngakho-ke, siphakamisa ukuthi sijwayele le nqubo ngokuningiliziwe, singafundile kuphela inqubo yokulayisha, kodwa futhi nokuhlelwa kwemingcele esemqoka.

Faka iSSH-server ku-Ubuntu

Izingxenye ze-SSH zitholakalayo ukuze zilandwe ngokusebenzisa i-repository esemthethweni, ngoba sizocabangela indlela enjalo, iyisimiso esiphezulu futhi sinokwethenjelwa, futhi ayibangeli ubunzima kubasebenzisi be-novice. Siphule yonke inqubo ibe yizinyathelo zokwenza kube lula kuwe ukuthi uhambe imiyalo. Ake siqale kusukela ekuqaleni.

Isinyathelo 1: Landa futhi ufake iSSH-server

Yenza lo msebenzi uzoba khona "Isikhumbuzo" usebenzisa umyalo oyinhloko wokusetha. Akudingekile ukuba nolwazi olwengeziwe noma amakhono, uzothola incazelo eningiliziwe yesenzo ngasinye nayo yonke imiyalo edingekayo.

  1. Run the console ngokusebenzisa imenyu noma ubambe inhlanganisela I-Ctrl + Alt + T.
  2. Masinyane qalisa ukulanda amafayela wevava kusuka ehhovisi elisemthethweni. Ukuze wenze lokhu, fakasudo apt ukufaka openssh-serverbese ucindezela ukhiye Ngena.
  3. Njengoba sisebenzisa lesi siqalo sudo (ukwenza isenzo egameni lomqambi omkhulu), kuzodingeka ufake iphasiwedi ye-akhawunti yakho. Qaphela ukuthi abalingiswa ababoniswa uma bengena.
  4. Uzokwaziswa ngokulanda kwe-archive ethile, uqinisekise isenzo ngokukhetha inketho D.
  5. Ngokuzenzakalelayo, iklayenti ifakwe nesiphakeli, kodwa ngeke kube yinto engafanelekile ukuqinisekisa ukuthi itholakala ngokuzama ukuyibuyiselasudo apt-get install openssh-iklayenti.

Iseva ye-SSH izotholakala ukuxhumana nayo ngokushesha ngemva kokufaka ngempumelelo wonke amafayela kwisistimu yokusebenza, kodwa kumele ihlelwe ukuze iqinisekise ukusebenza okulungile. Sikukwazisa ukuba uzijwayeze ngezinyathelo ezilandelayo.

Isinyathelo 2: Hlola ukusebenza kweseva

Okokuqala, masiqiniseke ukuthi izilungiselelo ezijwayelekile zisetshenziswe ngendlela efanele, futhi iSSH-iseva isabela emiyalweni eyisisekelo bese ibenza kahle, ngakho-ke kudingeka:

  1. Qalisa i-console bese ubhalisa laphoI-sudo systemctl inika amandla i-sshd, ukwengeza iseva ukuqala Ubuntu, uma kungazelelwe lokhu akuzange kwenzeke ngokuzenzakalelayo emva kokufakwa.
  2. Uma ungadingi ithuluzi ukuqala nge-OS, yisuse ku-autorun ngokuthayiphasudo systemctl khubaza i-sshd.
  3. Manje ake sihlole ukuthi ukuxhumeka kwikhompyutha yendawo kwenziwa kanjani. Sebenzisa isicelossh localhost(localhost - ikheli le-PC yakho yangakini).
  4. Qinisekisa ukuqhubeka koxhumano ngokukhetha Yebo.
  5. Endabeni yokulanda okuphumelelayo, uzothola into enjengale, njengoba ungabona esithombeni esilandelayo. Hlola isidingo sokuxhuma ekhelini0.0.0.0, okwenza njenge-IP yenethiwekhi ekhethiwe yamanye amadivayisi. Ukuze wenze lokhu, faka umyalo ofanele bese uchofoza Ngena.
  6. Ngexhumano olusha ngalunye, kuzodingeka uliqinisekise.

Njengoba ungabona, umyalo we-ssh usetshenziselwa ukuxhuma kunoma iyiphi ikhompyutha. Uma udinga ukuxhuma kwenye idivayisi, vele uqalise ukugcina bese ufaka umyalo kwifomethiIgama lomsebenzisi we-ssh @ ip_address.

Isinyathelo 3: Hlela ifayela lokucushwa

Zonke izilungiselelo ezengeziwe zeprothokholi ye-SSH zenziwe ngefayili ekhethekile yokumisa ngokushintsha izintambo namanani. Ngeke sigxilise kuwo wonke amaphuzu, ngaphezu kwalokho, iningi labo lingumuntu ngamunye kumsebenzisi ngamunye, sizobonisa kuphela izenzo eziyinhloko.

  1. Okokuqala, gcina ikhophi yokusekelayo yefayela lokucushwa ukuze uyifinyelele noma ubuyisele isimo sase-SSH sokuqala uma kwenzeka noma yini. Ku-console, faka umyalosudo cp / njll / ssh / sshd_config /etc/ssh/sshd_config.original.
  2. Khona-ke eyesibili:sudo chmod a-w /etc/ssh/sshd_config.original.
  3. Qalisa ifayela lokucushwa lenziwa ngokusebenzisasudo vi / njll / ssh / sshd_config. Ngokushesha ngemva kokungena kuzokwethulwa futhi uzobona okuqukethwe kwayo, njengoba kuboniswe ku-skrini ngezansi.
  4. Lapha ungashintsha ichweba elisetshenzisiwe, okuhlale kungcono ukuyenza ukuqinisekisa ukuphepha kokuxhumeka, bese ukungena ngemvume egameni lomphathi omkhulu (i-PermitRootLogin) kungakhutshazwa futhi kusebenze ukhiye wokuqalisa (i-PubkeyAuthentication). Lapho uqedile ukuhlela, cindezela ukhiye : (Shift +; ekhasini lekhibhodi yesiLatini) bese ufaka incwadiwukugcina izinguquko.
  5. Ukushiya ifayela kwenziwa ngendlela efanayo, esikhundleni salokho kuphelawisetshenziswaq.
  6. Khumbula ukuqala kabusha iseva ngokuthayiphasart systemctl ukuqalisa kabusha i-ssh.
  7. Ngemva kokushintsha i-port esebenzayo, udinga ukuyilungisa kuklayenti. Lokhu kwenziwa ngokucacisassh -p 2100 yendawo yangakinikuphi 2100 - inombolo yesitoreji esithathiwe.
  8. Uma une-firewall esilungisiwe, kuzodingeka indawo esikhundleni lapho:sudo ufw avumele u-2100.
  9. Uzothola isaziso sokuthi yonke imithetho ibuyekeziwe.

Ukhululekile ukuzijwayeza ngeminye imingcele ngokufunda imibhalo esemthethweni. Kukhona amathiphu ekuguquleni zonke izinto ukusiza ukuthola ukuthi yiziphi izimiso okufanele uzikhethele zona.

Isinyathelo 4: Ukwengeza Amakhi

Uma ungeza okhiye be-SSH, ukugunyazwa kuvula phakathi kwamadivayisi amabili ngaphandle kwesidingo sokungena ngaphambilini iphasiwedi. Inqubo yokuhlonza ikwakhiwa kabusha ngaphansi kwe-algorithm yokufunda ukhiye wangasese kanye nomphakathi.

  1. Vula i-console bese udala ukhiye wamaklayenti amasha ngokuthayiphai-ssh-keygen -i-dsabese unikezela igama efayeleni bese ucacisa iphasiwedi yokufinyelela.
  2. Ngemuva kwalokho, ukhiye womphakathi uzogcinwa futhi isithombe sesehlakalo sizodalwa. Esikrinini uzobona ukubukeka kwayo.
  3. Ihlala kuphela ukukopisha ifayela elidaliwe kukhompyutha yesibili ukuze unqamule uxhumano ngokusebenzisa iphasiwedi. Sebenzisa umyaloIgama lomsebenzisi le-ssh-copy-id @ remotehostkuphi Igama lomsebenzisi @ remotehost - igama lekhomputha elikude nekheli layo le-IP.

Ihlala kuphela ukuqala kabusha iseva futhi uqinisekise ukuthi isebenza kahle ngokusebenzisa ukhiye womphakathi nobumfihlo.

Lokhu kuqedela ukufakwa kwesiphakeli se-SSH nokusethwa kwayo okuyisisekelo. Uma ufaka yonke imiyalo ngokufanele, akukho amaphutha okufanele akwenze ngesikhathi kwenziwa umsebenzi. Uma kunoma yiziphi izinkinga zokuxhumeka ngemva kokusetha, zama ukususa i-SSH kusukela ekuqaleni ukuze uxazulule inkinga (funda ngakho Isinyathelo 2).