SINCRONIZAR CARPETAS A TRAVÉS DE SSH [apuntes]
currently have a "toy" back in the CEAMA, a virtual infrastructure based on VMware, running on two Dell servers with a total of 16 processors and 64 GB of RAM. With this toy you can create virtual machines with the necessary software to perform multiple tasks, or to accommodate different services (like our model repository or the information system of the Observatory).
In one of these virtual machines are running MaxEnt to generate models of distribution of threatened plants in Andalusia at 40 meter spatial resolution. But the results of MaxEnt I will process with GRASS on my machine laboratory personnel. To go to receive the results as they are generated, "enough" to synchronize the output folder of the virtual machine to a folder on my real machine. For this serves rsync, and a channel of communication will use ssh .
password in order to avoid generating ssh connections "confianza2 link between the two machines we first need to generate the key that identifies your computer. From the terminal type:
ssh-keygen
Eye, leave the passphrase empty.
To copy the key on the remote machine (all on one line):
numero.puerto scp-P ~ / .ssh / id_rsa.pub user@maquina.remota : / home / user / .ssh / authorized_keys
Once you have copied the key, we will synchronize the folders.
the virtual machine folder = / home / user / a folder on the machine
real = / home / user / b
From a terminal:
rsync-e ssh-avr user@maquina.remota: / home / user / a / / home / user / b /
If you are behind a router, and have redirected to the ssh port on your machine:
rsync-avr-e "ssh-p numero.puerto" user@maquina.remota: / home / user / a / / home / user / b /
The first time it will take a long drop to the real machine the entire contents of the folder. Once this happens, and only transmit the changes.
UPDATE: Thanks to Ramón Pérez I updated the entry, showing how to generate an RSA key to building trust between the two machines and avoid having to type the password when connecting.
NOTE: If you close the terminal from which to begin the process, timing stops. One option is to " & " (space more &) at the end of the line to run in the background. If you turn off your computer from time to time, have to put the line in the cron to run automatically every few minutes.
UPDATE 2: xurxo indicates that screen (it looks and this ) is a better alternative to the " & " to keep the process running in the background, it also allows you to regain control . Xurxo Thanks!.
0 comments:
Post a Comment