わかれば当たり前だけどはまったのでメモ。
ダブルコーテーション内では特殊文字(チルダなど)は文字列扱われる。
sshの鍵認証でrsyncしようとして、sshの鍵のパスをチルダで書いてしまったため、鍵がないというエラーが出た。
ダブルコーテーションの件に気付かず、ずっとrsyncの仕様を調べてはまった。
間違った例
rsync -r -e "ssh -i ~/.ssh/keyfile" /path/to/dir username@example.com:/path/to/foo/
=>Warning: Identity file ~/.ssh/keyfile not accessible: No such file or directory.
正しい例
#ダブルコーテーションなのでフルパスで書きましょう。
rsync -r -e "ssh -i /home/foo/.ssh/keyfile" /path/to/dir username@example.com:/path/to/foo/