0
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

crontabとrsyncを使ったファイルバックアップ自動化

Posted at

まずrootの直下に.sshの有無確認。

//バックアップ元サーバ
cd .ssh
ls -al
-rw------- 1 root root  381 11月 16  2024 authorized_keys
-rw-r--r-- 1 root root  444  5月 26 21:28 known_hosts
ssh-keygen -t rsa //ssh鍵生成
enter same passphrase :
enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub. //公開鍵
The key fingerprint is:
64:0b:7f:19:75:52:8a:48:1f:80:12:22:68:f4:05:1a root@*********************
The key's randomart image is:
+--[ RSA 2048]----+
|+E..oo .o.. o.o  |
|.o+.o .. o + +   |
|.. . .. + + .    |
|       = . o     |
|        S o      |
|         .       |
|                 |
|                 |
|                 |
+-----------------+
//catでコピー
cat /root/.ssh/id_rsa.pub
ssh-rsa BBBBBBBB3NzaC1yc2EAAAADAQ*********  root@v***.***.***.***
//バックアップ先サーバにてviにて下に貼り付ける。
vi authorized_keys
ssh-rsa AAAAAAAAAAA4NzaC1yc2EAAAADAQ*********  root@v***.***.***.***
ssh-rsa BBBBBBBB3NzaC1yc2EAAAADAQ*********  root@v***.***.***.***

上記の手順により、Shellにてrsyncを直接実行出来るので、更にcrontabにて適時に
バックアップを実行可能となる。

0
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?