r/linuxadmin • u/sdns575 • Jan 22 '26
rsync --server question
Hi,
I need to sync file between two hosts with rsync+ssh using private key. After key sharing I restrict the key to only one command: "/usr/bin/rsync --server -slHDtprze.iLsfxCIvu". It works, but I've a problem. If I try to connect to the host using the specified key but not using rsync it will hangs forever. There is a way to specifity to rsync a timeout when using --server or something similar?
Thank you in advance
10
Upvotes
View all comments
Show parent comment
2
u/sdns575 Jan 22 '26
Hi and thank you for your answer.
The problem is not running rsync+ssh with restricted key on a command. The timeout, if reached, will disconnect well.
The problem is when I try to connect using ssh, the same key on the same host (that force rsync --server...). In this case nothing will end, terminate and close the session like with "permission denied" or "Timeout reached. Disconnected". Sometime I use a script to run some check on the remote side with the same key but as said it hangs forever. One solution could be use another ssh key pair but I don't know if this is a non-sense using 2 keys for the same user.