Maitiro ekuTumira maFaira muLinux neSCP uye Rsync

Muchidzidzo ichi tichatsanangura mashandisiro eSCP (Yakachengeteka Kopi) uye Rsync, mirairo miviri inogona kushandiswa kuendesa mafaera pakati pemachina maviri.

Semuenzaniso, tinogona kuteedzera faira kana dhairekitori kubva kunharaunda kusvika kure kana kubva kure kuenda kumasisitimu emuno.

Paunenge uchishandisa scp kuendesa mafaera, zvese zvakavharirwa saka zvinyoro nyoro hazviburitswe.

Mune ino dzidziso, isu tinopa mienzaniso yekushandisa scp uye rsync mirairo yekuendesa mafaera.

SCP (Yakachengeteka Kopi)

scp kopi mafaera pakati pevagari pane network.

Iyo inoshandisa ssh (1) yekuchinjisa data, uye inoshandisa kumisikidza kumwechete uye inopa chengetedzo imwechete ssh (1).



I scp rairo inotsamira pa ssh yekufambisa data, saka zvinoda ssh kiyi kana password kuti usimbise pane ari kure masisitimu.

Iwe unogona kuverenga zvimwe nezve maitiro ekumisikidza ssh makiyi.

Iyo yakajairika syntax uye kushandiswa kwe scp nde:

scp [OPTION] [user@]local:]file1 [user@]remote:]file2

scp inopa dzinoverengeka sarudzo idzo dziri akatsanangura zvakadzama .

Chinjana Mafaira kubva kuNzvimbo kuenda Kure Kure neSCP

Kukopa kana kuendesa faira kubva kumuchina wemuno kuenda kumushini uri kure, mhanya unotevera kuraira:

scp image.png remote_username@10.10.0.1:/remote/directory

Kupi:

  • mufananidzo.png ndiro zita refaira ratiri kuda kuendesa kubva kunharaunda kuenda kure,
  • remote_username ndiye mushandisi pane iri kure server,
  • 10.10.0.1 ndiyo server IP kero,
  • / kure / dhairekitori ndiyo nzira inoenda kudhairekitori yatinoda kuteedzera faira racho.

Ongorora: Kana iwe ukasadoma dhairekitori iri kure, iyo faira inoteedzerwa kune iri kure mushandisi dhairekitori repamba.

Paunodzvanya pinda, iwe unozokurudzirwa kuisa iri kure mushandisi password uye kuchinjisa kunotanga.

Kusiya zita rezita kubva kunzvimbo yekuenda kunoteedzera iyo faira ine zita rekutanga. Kana iwe uchida kusevha iyo faira pasi pezita rakasiyana iwe unofanirwa kudoma zita idzva:

Semuyenzaniso:

scp image1.png remote_username@10.10.0.1:/remote/directory/new_image.png

Chinjana Mafaira kubva Kure Kure kune Local neSCP

Kuendesa faira kubva kumuchina uri kure kuenda kuneako wemuchina, mhanya unotevera kuraira:

scp remote_username@10.10.0.1:/remote/directory/new_image.png /local/directory

Chinjana Dhairekitori Zvichidzokorodza kubva Kunzvimbo kuenda Kure

Kuendesa dhairekitori nezvose zvirimo kubva mumuchina wemuno kuenda kunzvimbo iri kure, shandisa unotevera kuraira:

scp -rp sourcedirectory user@dest:/path

NB: Izvi zvinogadzira sourcedirectory mukati / nzira saka mafaera anenge ari mu / path / sourcedirectory

Rsync

Kunge scp, rsync inoshandiswa kuteedzera mafaera kungave kuenda kana kubva kure kure inomiririra, kana kunharaunda pane yazvino inomiririra.

rsync inowanzo shandiswa kuendesa makuru mafaera.

Chinjana Faira kubva kuKunharaunda kuenda Kure Kure neRsync

Kukopa faira kubva kumuchina wako wemuno kuenda kunzvimbo iri kure ne rsynch, mhanyisa unotevera kuraira

rsync -ave ssh mydirectory remote_user@10.10.0.2:/remote/directory/

Mhedziso

Muchidzidzo ichi, iwe wakadzidza kushandisa scp uye rsync raira kuteedzera mafaera uye madhairekitori pakati pemachina maviri.