티스토리 뷰
1. Origin 서버 lsyncd 설치
apt update&&upgrade
apt-get install -y lsyncd
2. Origin 서버 ssh key 생성
root@q381-1921:/# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no 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:
SHA256:/a3uBy9NYgx3isDrVnCUEH9pK+oYOM4NygJIBCDz+WY root@q381-1921
The key`s randomart image is:
+---[RSA 3072]----+
|B oo . |
|.+ . .o . |
|. o . .. + |
| . . +.oo... |
|o E S=o=.o |
|o o . ..oo*.. |
|. + .... ..*. |
|.. + + +o ..+ |
| .o o o.. o+o |
+----[SHA256]-----+
root@q381-1921:/# ls ~/.ssh/id_*
/root/.ssh/id_rsa /root/.ssh/id_rsa.pub
root@q381-1921:/# ssh-copy-id root@접속할 아이피
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '1.1.1.1 (1.1.1.1)' can`t be established.
ED25519 key fingerprint is SHA256:3LnG/lLjiytuDCvdn2Eh4qfaadjv69wLiWnnnvYBtQQ.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@183.111.64.4`s password:*********
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@1.1.1.1'"
and check to make sure that only the key(s) you wanted were added.
3. Origin서버 lsyncd 설정
root@q381-1921:/# cd /etc
root@q381-1921:/etc# mkdir lsyncd
root@q381-1921:/# cd lsyncd
root@q381-1921:/etc/lsyncd# vi lsyncd.conf.lua
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd-status.log",
statusInterval = 20
nodaemon = false
}
sync {
default.rsyncssh,
source="/data/images",
host="1.1.1.1",
targetdir="/data/images_backup",
delay = 1,
delete = false,
ssh = {
port = 22
},
rsync = {
archive = true,
compress = true,
verbose = true,
_extra = {"--bwlimit=730"}
}
}
:wq
root@q381-1921:/etc/lsyncd# cd /var/log
root@q381-1921:/var/log# mkdir lsyncd
root@q381-1921:/var/log# cd lsyncd
root@q381-1921:/var/log/lsyncd#
root@q381-1921:/var/log/lsyncd# touch lsyncd.log
root@q381-1921:/var/log/lsyncd# touch lsyncd-status.log
root@q381-1921:/var/log/lsyncd# systemctl restart lsyncd
root@q381-1921:/var/log/lsyncd# systemctl enable lsyncd
4. Sync서버 rsync 설치
root@Daniel:/# apt-get install -y rsync
root@Daniel:/# systemctl start rsync
5. Sync서버 rsync설정
root@Daniel# vi /etc/rsyncd.conf
# /etc/rsyncd: configuration file for rsync daemon mode
# See rsyncd.conf man page for more options.
# configuration example:
# uid = nobody
# gid = nobody
# use chroot = yes
# max connections = 4
# pid file = /var/run/rsyncd.pid
# exclude = lost+found/
# transfer logging = yes
# timeout = 900
# ignore nonreadable = yes
# dont compress = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2
# [ftp]
# path = /home/ftp
# comment = ftp export area
[web]
path = /data/images
comment = image_backup
hosts allow=2.2.2.2
uid = root
gid = root
use chroot = yes
read_noly = no
:wq
6. Sync 서버의 Rsync 포트를 방화벽에서 열어준다.
#iptables 포트 허용
-A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT
#ufw 포트 허용
ufw allow 22
'System > Linux' 카테고리의 다른 글
Tar 압축 및 해제 (0) | 2022.05.12 |
---|---|
[Ubuntu] 타임존 설정 (0) | 2022.04.21 |
SSH 접속시 에러 (0) | 2022.01.29 |
CentOS Stream으로 인한 대처 방안 (0) | 2021.04.21 |
[ CentOS6 ] 무료 SSL인 Let’s encrypt 설치와 관리 (0) | 2019.04.05 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- SSL
- letsencrypt
- Intellj들여쓰기
- 마이바티스CamelCase
- Letsencrypt wildcard
- Letsencrypt+nginx
- 마이바티스
- Letsencrypt wildcard auto renew
- camelcase
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
글 보관함