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.
- Run the console ngokusebenzisa imenyu noma ubambe inhlanganisela I-Ctrl + Alt + T.
- Masinyane qalisa ukulanda amafayela wevava kusuka ehhovisi elisemthethweni. Ukuze wenze lokhu, faka
sudo apt ukufaka openssh-server
bese ucindezela ukhiye Ngena. - Njengoba sisebenzisa lesi siqalo sudo (ukwenza isenzo egameni lomqambi omkhulu), kuzodingeka ufake iphasiwedi ye-akhawunti yakho. Qaphela ukuthi abalingiswa ababoniswa uma bengena.
- Uzokwaziswa ngokulanda kwe-archive ethile, uqinisekise isenzo ngokukhetha inketho D.
- Ngokuzenzakalelayo, iklayenti ifakwe nesiphakeli, kodwa ngeke kube yinto engafanelekile ukuqinisekisa ukuthi itholakala ngokuzama ukuyibuyisela
sudo 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:
- Qalisa i-console bese ubhalisa lapho
I-sudo systemctl inika amandla i-sshd
, ukwengeza iseva ukuqala Ubuntu, uma kungazelelwe lokhu akuzange kwenzeke ngokuzenzakalelayo emva kokufakwa. - Uma ungadingi ithuluzi ukuqala nge-OS, yisuse ku-autorun ngokuthayipha
sudo systemctl khubaza i-sshd
. - Manje ake sihlole ukuthi ukuxhumeka kwikhompyutha yendawo kwenziwa kanjani. Sebenzisa isicelo
ssh localhost
(localhost - ikheli le-PC yakho yangakini). - Qinisekisa ukuqhubeka koxhumano ngokukhetha Yebo.
- Endabeni yokulanda okuphumelelayo, uzothola into enjengale, njengoba ungabona esithombeni esilandelayo. Hlola isidingo sokuxhuma ekhelini
0.0.0.0
, okwenza njenge-IP yenethiwekhi ekhethiwe yamanye amadivayisi. Ukuze wenze lokhu, faka umyalo ofanele bese uchofoza Ngena. - 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.
- Okokuqala, gcina ikhophi yokusekelayo yefayela lokucushwa ukuze uyifinyelele noma ubuyisele isimo sase-SSH sokuqala uma kwenzeka noma yini. Ku-console, faka umyalo
sudo cp / njll / ssh / sshd_config /etc/ssh/sshd_config.original
. - Khona-ke eyesibili:
sudo chmod a-w /etc/ssh/sshd_config.original
. - Qalisa ifayela lokucushwa lenziwa ngokusebenzisa
sudo vi / njll / ssh / sshd_config
. Ngokushesha ngemva kokungena kuzokwethulwa futhi uzobona okuqukethwe kwayo, njengoba kuboniswe ku-skrini ngezansi. - 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 incwadi
w
ukugcina izinguquko. - Ukushiya ifayela kwenziwa ngendlela efanayo, esikhundleni salokho kuphela
w
isetshenziswaq
. - Khumbula ukuqala kabusha iseva ngokuthayipha
sart systemctl ukuqalisa kabusha i-ssh
. - Ngemva kokushintsha i-port esebenzayo, udinga ukuyilungisa kuklayenti. Lokhu kwenziwa ngokucacisa
ssh -p 2100 yendawo yangakini
kuphi 2100 - inombolo yesitoreji esithathiwe. - Uma une-firewall esilungisiwe, kuzodingeka indawo esikhundleni lapho:
sudo ufw avumele u-2100
. - 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.
- Vula i-console bese udala ukhiye wamaklayenti amasha ngokuthayipha
i-ssh-keygen -i-dsa
bese unikezela igama efayeleni bese ucacisa iphasiwedi yokufinyelela. - Ngemuva kwalokho, ukhiye womphakathi uzogcinwa futhi isithombe sesehlakalo sizodalwa. Esikrinini uzobona ukubukeka kwayo.
- Ihlala kuphela ukukopisha ifayela elidaliwe kukhompyutha yesibili ukuze unqamule uxhumano ngokusebenzisa iphasiwedi. Sebenzisa umyalo
Igama lomsebenzisi le-ssh-copy-id @ remotehost
kuphi 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).