I want to upload files using rsync
over SSH.
On server side I have:
In /root/.ssh/rsync.conf
:
uid = root
gid = root
use chroot = false
[data]
path = /var/www/data
In /root/.ssh/authorized_keys
I have:
command="rsync --server --daemon --config rsync.conf ." ssh-rsa AAAAB3N...
On client side I have ssh_config
file such as:
Host rsync_data
User root
IdentitiesOnly yes
IdentityFile /home/me/.ssh/id_rsa_rsync
ProxyCommand ssh eu -W 172.17.16.16:22
Host eu
User me
Port 4343
Hostname My_Public_IP_Address_here
IdentitiesOnly yes
IdentityFile /home/me/.ssh/id_rsa_rsync
Finally, command getting launched is:
rsync \
--delete \
-avz \
--stats \
--progress \
-e 'ssh -F /home/me/.ssh/config' \
/home/me/Documents/dev/data/ rsync_data::data
SSH connection goes well as read in /var/log/auth.log
but I get this rsync error:
rsync error: syntax or usage error (code 1) at clientserver.c(1223 [Receiver=3.2.3]
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(231) [sender=3.2.7]
How can I solve the issue I am encountering?
/root/.ssh/authorized_keys
or/root/.ssh/rsync.conf
? Whenever I do Rsync the most I have to do is just addid_rsa.pub
and then just do a plain Rsync without something like what you have here:-e 'ssh -F /home/me/.ssh/config'
. My initial thoughts is you are making this more complex than need be.rsync.conf`. Is there another way to do it ? Also if i only add SSH keys into
/root/.ssh/authorized_keys`` then anyone having access to client can directly get shell on server (as root!) where with this configuration, all an attacker can do is uploading wrong content that may be easier to dissmissroot
user n the destination server can access any file from any user. Why risk anything by usingroot
to transmit files? Create a new user, allow that user limited access to the destination directory and that’s that.