O Rsync via SSH não funciona

0

Eu quero fazer um backup de um Synology DiskStation (DSM 6.0.2-8451 Update 9) para um servidor CentOS6 usando o Rsync via SSH.

configuração do servidor CentOS6

/etc/rsyncd.conf

uid = root
gid = root
max connections = 10
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
auth users = synology
secrets file = /etc/rsyncd.secrets
max verbosity = 2
transfer logging = yes

[synology1]
path = /mnt/disk/synology/
hosts allow = xxx.xxx.xxx.xxx (Synology server's IP)
list = true
read only = no

/etc/xinetd.d/rsync

service rsync
{
    disable = no
    flags           = IPv6
    socket_type     = stream
    wait            = no
    user            = root
    server          = /usr/bin/rsync
    server_args     = --daemon
    log_on_failure  += USERID
}

Um usuário do sistema chamado 'synology' também existe no meu sistema, com uma senha igual à 'synology' do usuário rsync fornecida em /etc/rsyncd.secrets.

Eu tentei isso no servidor Synology:

rsync -av /tmp/try/ [email protected]::synology1 -e 'ssh -v'

e obtenha:

OpenSSH_6.8p1-hpn14v6, OpenSSL 1.0.2j-fips 26 Sep 2016
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port xxxxx.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/services/homes/admin/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.8p1-hpn14v6
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Remote is NON-HPN aware
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: AUTH STATE IS 0
debug1: REQUESTED ENC.NAME is 'aes128-ctr'
debug1: kex: server->client aes128-ctr [email protected] none
debug1: REQUESTED ENC.NAME is 'aes128-ctr'
debug1: kex: client->server aes128-ctr [email protected] none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxx
debug1: Host 'xxx.xxx.xxx.xxx' is known and matches the RSA host key.
debug1: Found key in /var/services/homes/admin/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Trying private key: /var/services/homes/admin/.ssh/id_rsa
debug1: Trying private key: /var/services/homes/admin/.ssh/id_dsa
debug1: Trying private key: /var/services/homes/admin/.ssh/id_ecdsa
debug1: Trying private key: /var/services/homes/admin/.ssh/id_ed25519
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]:xxxxx).
debug1: HPN to Non-HPN Connection
debug1: Final hpn_buffer_size = 2097152
debug1: HPN Disabled: 0, HPN Buffer Size: 2097152
debug1: channel 0: new [client-session]
debug1: Enabled Dynamic Window Scaling
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending command: rsync --server --daemon .
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 2872, received 2544 bytes, in 0.2 seconds
Bytes per second: sent 14501.0, received 12844.9
debug1: Exit status 1
rsync error: rsync service is no running (code 43) at io.c(687) [sender=3.0.9]

Ooooh, estou intrigado depois de várias tentativas e horas de googling embaçado. Poucas perguntas por minha causa!

1 / Eu realmente tenho que ter a mesma conta (usuário / senha) no meu sistema CentOS e na configuração do rsync para poder rsync via ssh?

2 / o que está causando meu " erro de rsync: o serviço rsync não está em execução " aqui? alguma ideia?

Obrigado por qualquer ajuda!

    
por Bob 14.02.2017 / 18:37

2 respostas

1

Você pode estar tentando combinar 2 usos ligeiramente diferentes do rsync como um daemon. A configuração do servidor responderá às solicitações na porta rsync 873, enquanto o seu comando está se conectando com -e ssh e, portanto, executando rsync --server --daemon sobre essa conexão. Se você olhar para a entrada da página de manual para --config=FILE , ele menciona

The default is /etc/rsyncd.conf unless the daemon is running over a remote shell program and the remote user is not the super-user; in that case the default is rsyncd.conf in the current directory (typi- cally $HOME)

No seu caso, você parece estar usando o usuário synology , então o arquivo rsyncd.conf provavelmente deve estar no diretório ~synology/ .

    
por 14.02.2017 / 20:35
0

1/ do I actually have to have the same account (user/password) on my CentOS system and on rsync configuration to be able to rsync via ssh?

Não, certamente não.

2/ what's causing my "rsync error: rsync service is no running" here? any idea?

No servidor, não há nenhum serviço rsync em execução no servidor. É muito provável que você perca esta parte (de acordo com o tutorial ):

/etc/rc.d/init.d/xinetd start 
    
por 14.02.2017 / 20:13