んたのブログ

週末になると出没します。

lsyncd再設定

確かにEndeavourOS再インストールしてから設定見直してなかったわ。
 
前回/領域がパンクした原因であるlsyncd.logのコピーを見てたら
 
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(231) [sender=3.2.7]
Mon Oct  2 08:18:02 2023 Normal: Retrying a list after exitcode = 255
Mon Oct  2 08:18:02 2023 Normal: Calling rsync with filter-list of new/modified files/dirs
 
EndeavourOS側からコネクションが切断されてる履歴がずーっと出てました。あー、そりゃログも肥大化するよね。sshのkeyはバックアップから戻したけど、EndeavourOS側でsshd起動してないわ。まずはそこからか。
 
$ sudo systemctl enable sshd
$ sudo systemctl start sshd
 
EndeavourOS上でsshdを起動して、DebianからEndeavourOSにログインできることは確認できました。で、現行のlsyncd.logを見てみたらなんか1分ごとにさっきまでとは別のエラーが。
 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!    @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ** key sent by the remote host is
SHA256:****************
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ED25519 key in /root/.ssh/known_hosts:3
  remove with:
  ssh-keygen -f "/root/.ssh/known_hosts" -R "IPアドレス"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
UpdateHostkeys is disabled because the host key is not trusted.
rsync: [Receiver] mkdir "/home/****/BACKUP/\#350\#266\#243\#345\#221\#263" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(789) [Receiver=3.2.7]
 
なぜにrootのknown_hosts?とは思いつつログにある通り
 
$ sudo ssh-keygen -f "/root/.ssh/known_hosts" -R "IPアドレス"
 
でrootのknown_hostsからEndeavourOSのIPを消してみました。でもログを見直すとまだまだ。
 
rsync: [Receiver] mkdir "/home/****/BACKUP/\#**\#**\#**\#**\#**\#**" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(789) [Receiver=3.2.7]
 
最初気づかなかったんですが、EndeavourOSのバックアップ先のフォルダ名がBACKUPから変えたんだったわ、ということでDebian側で
 
$ vi /etc/lsyncd/lsyncd.conf.lua
 
でバックアップ先のフォルダを現行のフォルダ名に修正してlsyncdを再起動。これでlsyncdが正常に動き出して同期できたことを確認できました。やれやれ、これで一安心。