![]() ![]() Then set the command on the command option of authorized_keys: user]$ sudo vi /root/.ssh/authorized_keysĬommand="rsync -server -ulogDtprz. ![]() Rsync error: protocol incompatibility (code 2) at backup]$ (see the rsync man page for an explanation) Protocol version mismatch - is your shell clean? home/backup/ is the command): backup]$ sudo rsync -vv -az -e "ssh -i /root/.ssh/rsync" /home/backup/ connection using ssh -i /root/.ssh/rsync -l root rsync -server -vvulogDtprz. (In this example, rsync -server -vvulogDtprz. Then find out the command executed on the remote host when you connect with rsync by using -vv option. Note that you have to set PermitRootLogin forced-commands-only in /etc/ssh/sshd_config on the remote host if you want to run rsync on the root privilege.įirst, make a key pair without a password and copy the public key to the remote host: user]$ sudo ssh-keygen -t dsa -N "" -f user]$ sudo scp /root/.ssh/rsync.pub add the public key to authorized_keys on the remote host: user]$ sudo sh -c 'cat ~user/rsync.pub > /root/.ssh/authorized_keys' You can use rsync via ssh without a password by using public key authentication (key pair with no password) and the command option of authorized_keys. Only when the transfer is finished do I remove the older version. Since there can be deletions I always make a new directory and enter it via FileZilla on the target 1TB HDD so only the relevant files are transferred. The alternative is to use FileZilla to send it the NAS server manually. ssh -e"mv /mnt/fullsys/mysystem mysystem.bak" -e"mkdir /mnt/fullsys/mysystem" -r /mnt/full/mysystem It takes a while but then it is done. I always make a new directory on the target NASserver:/mnt/fullsys/mysystem so only the relevant files are transferred. Time sudo rsync -aAXv / -delete -ignore-errors -exclude= /mnt/full/mysystem If you do not have a physical hard drive, and have enough space available, you just create a subdirectory under /mnt (or /media) and use that.Īs long as the directory is excluded it doesn't matter if it is on a separate drive or not.Įcho "="Įcho " BEGINNING rsync from root to /mnt/full/sysbkp" Ssh-copy-id -i ~/.ssh/id_rse.pub NASserverĪnd maybe something like this: scp myfile have a second hard drive so I use rsync to copy the boot drive to a subdirectory on sdb1 (mounted under /mnt and excluded from the rsync). If you haven't already, do this: ssh-keygen This answer explains how to use rsync itself without a password.Īlso, there is no need to install yet another daemon (rsync) on either system. And the best part is that you can use all the benefits of the rsync program. After that, day by day, no password prompts happen. The only time you need the password is when you set up the initial ssh-copy-id to set up the RSA passwordless logins. FileZilla will work, too.Īll of this (except FileZilla) can work in cron without a password. (to a directory under /mnt or /media you created or on a device youĢ) TRANSFER files WITH scp as shown below. This answer works with a generic Linux NAS They also all share the deficiency of requiring a rsync daemon running on the file server. rsync -avz -e ssh /home/test/ these rsync suggestions are failing using the latest version in August 2017 on Ubuntu 16.04 LTS. ssh the rsync again, it should not ask you to enter any password Now, you should be able to ssh to remote host without entering the If ssh-copy-id doesn’t work for you, use the method weĭiscussed earlier to setup ssh password less login.Ĥ. Host, and copy the public key automatically to the appropriate ssh-copy-id -i ~/.ssh/id_rsa.pub The above will ask the password for the user account on the remote Use ssh-copy-id, to copy the public key to the remote host. ssh-copy-id copies public key to remote host ![]() Passphrase just press enter key, and do not give any password here.ģ. Use ssh-keygen on local server to generate public and privateĮnter passphrase (empty for no passphrase):Įnter same passphrase again: Note: When it asks you to enter the Now setup ssh so that it doesn’t ask for password when you perform rsync -avz -e ssh /home/test/ ssh-keygen generates keys. This should ask you for the password of your account on the remote To the remote folder /backup/test (on 192.168.200.10 server). The following example will synchronize the local folder /home/test The remote server, and successfully copies the files to the remote Below is the article from The Geek Stuff:ĭo a rsync to make sure it asks for the password for your account on ![]()
0 Comments
Leave a Reply. |