LoginSignup
0
0

More than 5 years have passed since last update.

CygwinからCentOS7.2(Vagrant Box)にrsyncできない時

Last updated at Posted at 2016-12-02

問題発生

Vagrantで以下のbox使ってCentOS7.2の環境を作成
CentOS 7.2 x64 (Minimal, Puppet 4.2.3, Guest Additions 4.3.30) (http://www.vagrantbox.es/ )

Cygwinからsshできるように手元のid_rsa.pubをauthorized_keysに入れようとしてみた。

$ rsync /home/myname/.ssh/id_rsa.pub root@192.168.66.133:~/.ssh/authorized_keys
root@192.168.66.133's password: 

するとこんなエラー。

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.2]

なぜだろう。

解決編

答えはrsyn: command not foundと書いてあるように、CentOSの仮想環境にrsyncが入ってないから。だから初期化処理で以下のスクリプトを実行するようにした。

Vagrantfile
     centos_72.vm.provision "shell", path: "provision/install_packages.sh"
provision/install_packages.sh
#!/usr/bin/env bash

yum -y update
yum -y install rsync

これで無事rsyncができるようになりました。

$ rsync /home/myname/.ssh/id_rsa.pub docker_test:~/.ssh/authorized_keys
root@192.168.66.133's password: 

myname@myhost : 2016/12/01 13:39:25
$
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0