Txhim kho SSH-neeg rau zaub mov hauv Ubuntu

Qhov kev sib txuas lus SSH yog siv los muab kev ruaj ntseg txuas mus rau lub computer, uas tso cai rau kev tswj chaw nyob tsis yog ntawm lub tshuab plhaub khiav hauj lwm xwb, tab sis kuj los ntawm ib qho encrypted channel. Tej zaum, cov neeg siv ntawm Ubuntu operating system yuav tsum nruab ib tug neeg rau SSH hauv lawv lub PC rau txhua lub hom phiaj. Yog li, peb xav kom tau ntsib cov txheej txheem no hauv kev nthuav dav, muaj kev kawm tsis tau tsuas yog siv cov txheej txheem, tab sis tseem qhov chaw ntawm cov tsis yooj yim.

Nruab SSH-neeg rau zaub mov hauv Ubuntu

SSH Cheebtsam yog muaj nyob rau hauv kev tshaj tawm los ntawm tus nom repository, vim hais tias peb yuav xav txog ib txoj kev xwb, nws yog qhov ruaj khov thiab txhim khu kev qha, thiab tsis ua teeb meem rau cov neeg siv novice. Peb tau ua txhaum tag nrho cov txheej txheem rau hauv cov kauj ruam los ua kom yooj yim dua rau koj taug qab cov lus qhia. Cia peb pib los ntawm thaum pib.

Kauj ruam 1: Download tau thiab Nruab SSH tus neeg rau zaub mov

Ua tiav txoj hauj lwm yuav dhau los "Terminal" siv lub ntsiab lus txib. Nws tsis tas yuav muaj kev paub ntxiv lossis kev txawj ntse, koj yuav tau txais ib qho kev qhia ntxaws txog txhua qhov kev ua thiab tag nrho cov lus txib tsim nyog.

  1. Khiav lub console los ntawm cov ntawv qhia zaub mov los yog tuav ua ke nrog Ctrl + Alt + T.
  2. Tam sim ntawd pib downloading neeg rau zaub mov ntaub ntawv los ntawm tus nom repository. Ua li no, sausudo apt nruab openssh-neeg rau zaub movthiab tom qab ntawd nias tus yawm sij Sau.
  3. Vim peb siv lub prefix sudo (ua yeeb yam rau tus superuser), koj yuav tsum sau ib lo lus zais rau koj tus account. Nco ntsoov tias cov cim tsis tso tawm thaum nkag mus.
  4. Koj yuav tau txais ntawv ceeb toom txog ntawm ib qho nqi ntawm cov ntawv sau cia, paub meej tias qhov kev txiav txim los ntawm kev xaiv qhov kev xaiv D.
  5. Yog vim li cas, tus neeg tau txais kev pab nrog cov neeg rau zaub mov, tab sis nws yuav tsis yog qhov teeb meem kom paub tseeb tias nws muaj los ntawm kev sim rov qab siv nwssudo apt-mus nruab openssh-neeg.

SSH neeg rau zaub mov yuav tsum muaj kev cuam tshuam nrog nws tam sim ntawd tom qab txhim kho tag nrho cov ntaub ntawv rau kev khiav hauj lwm, tab sis nws yuav tsum tau teeb tsa kom ua haujlwm kom tseeb. Peb qhia koj kom paub koj tus kheej nrog cov kauj ruam nram qab no.

Kauj ruam 2: Kuaj xyuas cov neeg siv khoom lag luam

Ua ntej, cia siab tias tus txheej txheem teev tau thov kom raug, thiab SSH-neeg rau zaub mov teb rau cov lus txib thiab ua raws li lawv kom raug, yog li koj xav tau:

  1. Tua tawm lub console thiab sau npe rausudo systemctl pab sshd, ntxiv rau cov neeg rau zaub mov yuav pib startup Ubuntu, yog tias dheev qhov no tsis tshwm sim tom qab installation.
  2. Yog tias koj tsis xav tau lub cuab tam los pib nrog lub OS, tshem tawm los ntawm autorun los ntaus ntawvsudo systemctl lov tes taw sshd.
  3. Tam sim no cia saib seb qhov kev txuas mus rau lub koos pij tawj hauv zos tau ua. Siv cov lus txibssh localhost(localhost - qhov chaw nyob ntawm koj lub PC hauv zos).
  4. Tshawb xyuas qhov txuas ntxiv ntawm txoj kev sib txuas los ntawm kev xaiv yog.
  5. Nyob rau hauv cov ntaub ntawv ntawm ib tug zoo ces, koj yuav tau txais ib yam dab tsi zoo li no, raws li koj tau pom nyob rau hauv cov nram qab no screenshot. Xyuas qhov xav tau los txuas rau qhov chaw nyob0.0.0.0, uas ua raws li tus xaiv lub vas sab network IP rau lwm yam khoom siv. Ua li no, sau cov lus txib kom tsim nyog thiab nias rau Sau.
  6. Nrog txhua qhov kev txuas tshiab, koj yuav tsum paub meej tias nws.

Raws li koj tau pom, tus ssh hais kom siv yog txuas rau txhua lub computer. Yog tias koj xav tau txuas nrog lwm lub tshuab, cias tso lub davhlau ya nyob twg thiab nkag mus rau qhov kev qhia ua kessh username @ ip_address.

Kauj Ruam 3: Kho kom raug cov ntaub ntawv kho

Tag nrho cov teeb meem ntxiv rau SSH raws tu qauv yog tsim los ntawm cov ntaub ntawv tshwj xeeb kev configuration los hloov cov hlua thiab qhov tseem ceeb. Peb yuav tsis tsom tag nrho cov ntsiab lus, dhau mus, feem ntau ntawm lawv yog tus neeg siv rau txhua tus neeg siv, peb yuav tsuas yog qhia cov ntsiab tseem ceeb.

  1. Ua ntej tshaj, tseg ib thaub qab ntawm cov ntaub ntawv txhawm rau kom nkag mus rau los yog rov qab SSH lub xeev thaum muaj dab tsi. Nyob rau hauv lub console, ntxig txoj lus txibsudo cp / etc / ssh / sshd_config /etc/ssh/sshd_config.original.
  2. Ces tus thib ob:sudo chmod a-w /etc/ssh/sshd_config.original.
  3. Khiav cov ntaub ntawv ua tiav yog ua los ntawmsudo vi / etc / ssh / sshd_config. Tam sim ntawd tom qab nkag rau nws yuav tsum launched thiab koj yuav pom nws cov ntsiab lus, raws li qhia hauv screenshot hauv qab no.
  4. Ntawm no koj tuaj yeem hloov qhov chaw nres nkoj siv, uas yog ib txwm zoo dua los ua kom muaj kev ruaj ntseg ntawm txoj kev txuas, ces tus ID nkag mus sawv cev ntawm superuser (PermitRootLogin) tuaj yeem yog neeg xiam oob khab thiab qhib kev ua haujlwm enabled (PubkeyAuthentication). Thaum sau tiav ntawm qhov editing, nyem qhov tseem ceeb : (Ua haujlwm +; nyob rau Latin keyboard layout) thiab ntxiv ib tsab ntawvwkom txuag tau kev hloov.
  5. Tawm hauv cov ntaub ntawv yog ua li qub, tsuas yog siv xwbwyog sivq.
  6. Nco ntsoov pib dua tus neeg teb xov tooj yog sausudo systemctl restart ssh.
  7. Tom qab hloov chaw nres nkoj, koj yuav tsum kho nws hauv tus neeg mob. Qhov no yog ua los ntawm specifyingssh -p 2100 localhostqhov twg 2100 - tus naj npawb ntawm chaw nres nkoj hloov tshiab.
  8. Yog tias koj muaj ib qho thaiv kev ruaj ntseg, ib qho kev hloov kuj yuav tsum muaj:sudo ufw cia 2100.
  9. Koj yuav tau txais ib qho kev ceeb toom tias tag nrho cov cai raug hloov tshiab.

Koj ywj pheej kom paub koj tus kheej nrog lwm cov kev tsis tau los ntawm kev nyeem cov ntaub ntawv ua pov thawj. Muaj tswv yim txog kev hloov tag nrho cov khoom los pab txiav txim siab txog yam uas koj yuav tsum tau xaiv.

Kauj ruam 4: Ntxiv cov Yuam Sij

Thaum muab cov ntawv tseem ceeb hauv SSH, kev tso cai qhib ntawm ob qho khoom uas tsis tas yuav tsum nkag mus nkag rau lo lus zais. Kev txhim kho txheej txheem yog rov qab tsim nyob rau hauv qhov kev ntsuas ntawm kev nyeem ntawv ntawm daim card thiab cov pej xeem huab hwm.

  1. Qhib ib qho kev nplig thiab tsim kom muaj ib tus neeg tuaj tshiab los ntawm kev sau npessh-keygen -t dsathiab tom qab ntawd muab lub npe rau hauv cov ntaub ntawv thiab qhia kom meej tus password rau kev nkag.
  2. Tom qab ntawd, cov yuam sij rau pej xeem yuav tau txais kev cawmdim thiab yuav tsim ib daim duab zais cia. Ntawm qhov kev tshuaj ntsuam koj yuav pom nws cov tsos.
  3. Nws tshua tsuas yog luam cov ntaub ntawv tsim kom muaj ob lub computer thiaj li tshem tau qhov kev txuas los ntawm ib lo lus zais. Siv qhov kev hais kom uassh-copy-id username @ remotehostqhov twg username @ remotehost - lub npe ntawm lub computer tej thaj chaw deb thiab nws qhov chaw nyob IP.

Nws tshua tsuas yog pib dua tus neeg rau zaub mov thiab xyuas tias nws ua haujlwm kom yog los ntawm tsoomfwv thiab tus yuam sij.

Qhov no ua tiav qhov kev txhim kho ntawm SSH neeg rau zaub mov thiab nws cov kev sau yooj yim. Yog tias koj sau tag nrho cov lus txib kom raug, tsis muaj qhov yuam kev yuav tsum tshwm sim thaum ua tiav txoj haujlwm. Nyob rau hauv cov ntaub ntawv ntawm tej teeb meem nrog kev twb kev txuas tom qab teeb, sim tshem SSH los ntawm startup kom daws tau qhov teeb meem (nyeem txog nws nyob rau hauv Kauj Ruam 2).