🚀 NUOVO FORUM della famiglia SynologyItalia
☀️ Forum Solare Off-Grid 🔋
🏡 Dalla domotica al solare: stessa famiglia, nuove energie!
💰 SCONTI ESCLUSIVI solo per gli iscritti! 💰
🤝 BASEN e altri brand ti aspettano con offerte speciali 📞
🔒 Contenuti riservati visibili solo dopo l'iscrizione
🌡️ Energia solare, batterie, inverter: tutto off-grid in un posto! 🔋

[RISOLTO]Backup con rsync su NAS DS112J

Argomenti inerenti backup e sincronizzazione (locale, remota e in cloud)
Rispondi
nottambulo
Utente
Utente
Messaggi: 45
Iscritto il: lunedì 25 novembre 2013, 19:46

[RISOLTO]Backup con rsync su NAS DS112J

Messaggio da nottambulo »

Ciao, avrei esigenza di utilizzare rsync client da una macchina GNU/Linux, per un backup automatizzato sul nas in oggetto. In pratica vorrrei inserire il job nel crontab dell'utente e poi provvedere ad effettuare il backup di una serie di directory, il tutto utilizzando le chiavi ssh RSA senza passphrase, senza password. Il problema è che quando cerco di copiare la chiave ssh dell'utente con questo comando:

Codice: Seleziona tutto

ssh-copy-id -i id_rsa.pub -p PORTAINASCOLTO [email protected]
mi restituisce:

Codice: Seleziona tutto

Permission denied, please try again.
Posto il mio file sshd_config:

Codice: Seleziona tutto

#	$OpenBSD: sshd_config,v 1.82 2010/09/06 17:10:19 naddy Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

Port PORTAINASCOLTO
#AddressFamily any
ListenAddress 192.168.0.2
#ListenAddress ::

# The default requires explicit activation of protocol 1
#Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile	.ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication no
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing, 
# and session processing. If this is enabled, PAM authentication will 
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
#UsePAM no

#AllowAgentForwarding yes
AllowTcpForwarding no
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
ChrootDirectory none
#ChrootDirectory /var/services/homes/%u
#DenyUsers admin

# no default banner path
#Banner none

# override default of no subsystems
#Subsystem	sftp	/usr/libexec/sftp-server
#Subsystem       sftp    internal-sftp -f DAEMON -l VERBOSE -u 000
Subsystem       sftp    internal-sftp -f DAEMON -u 000
#Subsystem       sftp    /usr/syno/sbin/sftp-server -l DEBUG3

# the following are HPN related configuration options
# tcp receive buffer polling. disable in non autotuning kernels
#TcpRcvBufPoll yes
 
# allow the use of the none cipher
#NoneEnabled no

# disable hpn performance boosts. 
#HPNDisabled no

# buffer size for hpn to non-hpn connections
#HPNBufferSize 2048


# Example of overriding settings on a per-user basis
Match User root
#	X11Forwarding no
	AllowTcpForwarding yes
#	ForceCommand cvs server

In altre parole come utente normale non riesco a collegarmi via ssh sul NAS, mentre come root SI.
Ho creato lo stesso utente sul NAS, come root riesco a collegarmi.
Ultima modifica di nottambulo il lunedì 9 dicembre 2013, 23:00, modificato 1 volta in totale.
iMac 2021 M1
Synology DS220+
Synology DS112J
UPS Vultech
burghy86
Moderatore
Moderatore
Messaggi: 11696
Iscritto il: martedì 11 settembre 2012, 18:59

Re: Backup con rsync su NAS DS112J

Messaggio da burghy86 »

per gli script mi sa sei obbligato a loggarti in root..
NUOVO CANALE DISCORD e telegram
PARTECIPATE NUMEROSI:

https://discord.gg/McP3d4m2pG

https://t.me/Synology_IT



Passare dalla sezione presentazioni e leggere il regolamento firma obbligatorio

siamo una community, aiutateci a sentirci parte di qualcosa e non un helpdesk
Non do aiuto in privato ma sul forum a tutti!!
Un grazie ci spinge a lavorare meglio
------------------------------------------------------------
  • UPS: apc
  • GTW: fritzbox ISP: ftth 2.5gb/1) IP:[pubblico]
  • SWC: hp gigabit 8 porte with poe
  • NAS: 923+ 720+ dmv dal 6.2 alla 7., all hd con wdred/ironwolf da 2/6tb
  • CLI: win11 e ubuntu
    [altro]
  • 3 smartphone android, lettore bd , firestik 4k raspberry p3
nottambulo
Utente
Utente
Messaggi: 45
Iscritto il: lunedì 25 novembre 2013, 19:46

Re: Backup con rsync su NAS DS112J

Messaggio da nottambulo »

da burghy86
per gli script mi sa sei obbligato a loggarti in root..
Ok, però non capisco perchè collegandomi da root in questa maniera:

Codice: Seleziona tutto

ssh -p PORTAINASCOLTO 192.168.0.2
mi chiede sempre la passord anche se ho impostato l'autenticazione tramite le chiavi ssh:

Codice: Seleziona tutto

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile   .ssh/authorized_keys

PasswordAuthentication no
A questo punto nn posso automatizzare il processo con un job nel crontab di root
iMac 2021 M1
Synology DS220+
Synology DS112J
UPS Vultech
burghy86
Moderatore
Moderatore
Messaggi: 11696
Iscritto il: martedì 11 settembre 2012, 18:59

Re: Backup con rsync su NAS DS112J

Messaggio da burghy86 »

le chiavi del certificati ssh non sostituiscono la password, quella deve esserci sempre
NUOVO CANALE DISCORD e telegram
PARTECIPATE NUMEROSI:

https://discord.gg/McP3d4m2pG

https://t.me/Synology_IT



Passare dalla sezione presentazioni e leggere il regolamento firma obbligatorio

siamo una community, aiutateci a sentirci parte di qualcosa e non un helpdesk
Non do aiuto in privato ma sul forum a tutti!!
Un grazie ci spinge a lavorare meglio
------------------------------------------------------------
  • UPS: apc
  • GTW: fritzbox ISP: ftth 2.5gb/1) IP:[pubblico]
  • SWC: hp gigabit 8 porte with poe
  • NAS: 923+ 720+ dmv dal 6.2 alla 7., all hd con wdred/ironwolf da 2/6tb
  • CLI: win11 e ubuntu
    [altro]
  • 3 smartphone android, lettore bd , firestik 4k raspberry p3
nottambulo
Utente
Utente
Messaggi: 45
Iscritto il: lunedì 25 novembre 2013, 19:46

Re: Backup con rsync su NAS DS112J

Messaggio da nottambulo »

Non credo di essere dello stesso pensiero, se io mi collego via ssh sul nas utilizzando le chiavi generate:

Codice: Seleziona tutto

ssh -p PORTAINASCOLTO 192.168.0.2
non mi viene chiesta nessuna password proprio perchè impostato sul file sshd_config. Il problema sorge nel momento in cui cerco di effettuare il backup con rsync e mi chiede la passord del root del NAS:

Codice: Seleziona tutto

rsync -avz -e "ssh -p 2865" --delete /media/nottambulo/500_WD/Backup/Documenti [email protected]::NetBackup/Settimanale
iMac 2021 M1
Synology DS220+
Synology DS112J
UPS Vultech
nottambulo
Utente
Utente
Messaggi: 45
Iscritto il: lunedì 25 novembre 2013, 19:46

[RSIOLTO]Re: Backup con rsync su NAS DS112J

Messaggio da nottambulo »

Aggiorno questo post per mia futura memoria e affichè possa esser d'aiuto anche ad altri utenti.
Il mio, era un errore 'semplicemente' di sintassi, il comando corretto per automatizzare il backup incrementale è il seguente:

Codice: Seleziona tutto

rsync -avuz --delete-after -e "ssh -i /root/.ssh/id_rsa -p PORTA_IN_ASCOLTO" /home/nottambulo [email protected]:/volume1/NetBackup/
Infatti inserendo il job nel crontab di root, quest'ultimo viene processato senza far intervenire l'utente nell'inserire password, gli basterà andare a cercare nella directory specificata, la chiave asimmetrica SSH precedentemente creata.
iMac 2021 M1
Synology DS220+
Synology DS112J
UPS Vultech
Rispondi

Torna a “Backup&Restore, RSync, TimeBackup”