Si trabajamos a menudo con rsync para copiar archivos entre ordenadores, estaremos acostumbrados a una sintaxis parecida a esta:
$ rsync -avh origen usuario@servidor:destino
En realidad, para transmitir los archivos estaremos utilizando una conexión segura a través de ssh. Pero claro, en ocasiones, sería necesario utilizar algún argumento especial para ssh. En este ejemplo, imaginemos que queremos conectar al servidor por un puerto diferente del 22.
Podemos hacerlo así:
$ rsync -avh -e ‘ssh -p1234’ origen usuario@servidor:destino
y si accedemos por par de claves pública-privada, en el caso de que queramos especificar un archivo de clave privada específico para esta conexión (a mí me ha sucedido que he necesitado utilizar rsync como root para poder acceder a algunos archivos y las claves las tenía en el usuario actual), lo podemos hacer así:
$ rsync -avh -e ‘ssh -i archivo_identidad’ origen usuario@servidor:destino
Ahora, un ejemplo completo y concreto de todo, en el que queremos acceder a nuestro servidor SSH por el puerto 28, además, el archivo de identidad o clave privada es id_rsa_webserver dentro del directorio .ssh de nuestro usuario (muy útil si ejecutamos rsync como root) luego el origen serían todos los archivos que encontramos en www/ y los copiaremos en un directorio remoto de nuestro servidor (tenemos que tener permiso para escribir ahí)
$ rsync -avh -e ‘ssh -p28 -i /home/gaspar/.ssh/id_rsa_webserver’ www/* gaspar@miservidorweb.com:/home/web/externo/htdocs/
Configuración local de ssh
Otra posibilidad sería crear un archivo de configuración de ssh en nuestro ordenador, en el que podamos especificar los hosts a los que conectamos, el usuario que queremos utilizar, el archivo de identidad y el puerto.
El archivo será /home/usuario/.ssh/config donde usuario sería nuestro nombre de usuario. Y su contenido sería algo como esto:
Host miservidorweb.com
IdentityFile ~/.ssh/id_rsa_webserver
User gaspar
Port 28
No tienen que estar todas estas líneas, y si buscamos información, podemos configurar más cosas. En ese archivo podemos también, poner tantos Host xxxx como queramos.
Foto: Andrew Pons (Unsplash)
Pingback: Cómo especificar puerto y clave privada para SSH desde rsync | PlanetaLibre /
Pingback: ¿Cómo cambié mi WordPress de dominio? Minimizando el tiempo de corte y el impacto SEO – Poesía Binaria /
Your blog provided us with valuable information. I am looking forward to read more blog posts from here keep it up!
Spider Punk Black Vest
Wow what a Great Information about World Day its incredibly charming instructive post. an obligation of appreciation is all together for the post. pasar123
These web slots are not just big; they’re epic! Can’t wait to try them all. สล็อตเว็บใหญ่ที่สุด
This is essential, however it’s important to enable you to make a beeline for it weblink: 안전놀이터
This is energizing, in any case it is imperative for you to visit this particular url: 먹튀커뮤니티
Breaking slots can be a costly and annoying problem. Do you think it’s a design flaw or a quality issue? เว็บตรง แตกง่าย
Cool you record, the data is extremely salubrious further entrancing, I’ll give you an associate with my scene. รวมสล็อตทุกค่าย
Extremely pleasant and fascinating post. I was searching for this sort of data and appreciated perusing this one. Continue posting. Much obliged for sharing. 실시간스포츠중계
Extremely pleasant and fascinating post. I was searching for this sort of data and delighted in perusing this one. 대구블로그
2up Sports Social Game APP is the newest type of sports social entertainment game in the world in 2020’s. 2up Sports adapts to the web3 era and the wave of mobile internet, oriented to the personality, health, fashion, popularity, new trend, all-day socialization concept of the young generation of 00’s. 2up
You bear through a wonderful opening. I rational soundness unquestionably quarry it besides by and by propose to my buddys. I am reserved they assurance be profited from this scene. ป๊อกเด้ง ออนไลน์
An obligation of appreciation is all together for the informational and pleasing post, plainly in your blog everything is extraordinary.. เกมสล็อตโรม่า
It ought to be noticed that while requesting papers available to be purchased at paper composing administration, you can get unkind state of mind. In the event that you feel that the authority is endeavoring to cheat you, don’t purchase research project from it. 토토사이트 추천
This is exceptionally fascinating, yet it is important to tap on this connection: 401k vs ira
This is a great post I seen because of offer it. It is truly what I needed to see seek in future you will proceed after sharing such a magnificent post. spookyswap
Excellent read, Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Land Filling Service
All things considered I read it yesterday yet I had a few musings about it and today I needed to peruse it again in light of the fact that it is extremely elegantly composed. best concierge doctor