ssh timeout with rsync and Ubuntu 18.10Can't share an ssh connection with rsyncAdjusting rsync TCP timeoutExclude directories with 'rsync' and ssh with pull requestrsync with different userRSYNC periodically fails via SSH, broken pipeRsync -e option to sshRsync Wildcard Expansion Broken with SSHrsync with different ssh portsWhen to use ClientAliveInterval versus ServerAliveIntervalssh login fails with timeout

How can I prevent hyper evolved versions of regular creatures from wiping out their cousins?

What is the offset in a seaplane's hull?

How does one intimidate enemies without having the capacity for violence?

How is it possible to have an ability score that is less than 3?

In Japanese, what’s the difference between “Tonari ni” (となりに) and “Tsugi” (つぎ)? When would you use one over the other?

Prove that NP is closed under karp reduction?

How much RAM could one put in a typical 80386 setup?

Python: next in for loop

How did the USSR manage to innovate in an environment characterized by government censorship and high bureaucracy?

To string or not to string

The Two and the One

Do VLANs within a subnet need to have their own subnet for router on a stick?

Is it possible to do 50 km distance without any previous training?

How is the claim "I am in New York only if I am in America" the same as "If I am in New York, then I am in America?

strToHex ( string to its hex representation as string)

Why was the small council so happy for Tyrion to become the Master of Coin?

Why Is Death Allowed In the Matrix?

How can I make my BBEG immortal short of making them a Lich or Vampire?

Has the BBC provided arguments for saying Brexit being cancelled is unlikely?

Why don't electron-positron collisions release infinite energy?

Email Account under attack (really) - anything I can do?

The use of multiple foreign keys on same column in SQL Server

Why can't I see bouncing of a switch on an oscilloscope?

Why do I get two different answers for this counting problem?



ssh timeout with rsync and Ubuntu 18.10


Can't share an ssh connection with rsyncAdjusting rsync TCP timeoutExclude directories with 'rsync' and ssh with pull requestrsync with different userRSYNC periodically fails via SSH, broken pipeRsync -e option to sshRsync Wildcard Expansion Broken with SSHrsync with different ssh portsWhen to use ClientAliveInterval versus ServerAliveIntervalssh login fails with timeout






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I experienced this strange behavior with rsync command:



sudo rsync --timeout=300 --compress-level=9 -aHe "ssh -o ConnectTimeout=200 -o ServerAliveInterval=2 -ServerAliveCountMax=200" --progress --delete -z /media/Restic/* root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic


After few minutes, I get the error



rsync: [sender] write error: Broken pipe (32)


I tested with another concurrent ssh session in second terminal window running ping to gateway and it keeps running even when rsync breaks, it just pauses for a while when rsync breaks. It seems to me that Ubuntu kills the connection for a second or two and then resumes.



I wonder why ssh on rsync reports broken pipe immediately and does not wait for timeout 200 or 300 that I have set up in the command.










share|improve this question









New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    You are missing -o before -ServerAliveCountMax. Is this just a copying error?

    – meuh
    2 days ago

















1















I experienced this strange behavior with rsync command:



sudo rsync --timeout=300 --compress-level=9 -aHe "ssh -o ConnectTimeout=200 -o ServerAliveInterval=2 -ServerAliveCountMax=200" --progress --delete -z /media/Restic/* root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic


After few minutes, I get the error



rsync: [sender] write error: Broken pipe (32)


I tested with another concurrent ssh session in second terminal window running ping to gateway and it keeps running even when rsync breaks, it just pauses for a while when rsync breaks. It seems to me that Ubuntu kills the connection for a second or two and then resumes.



I wonder why ssh on rsync reports broken pipe immediately and does not wait for timeout 200 or 300 that I have set up in the command.










share|improve this question









New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.















  • 1





    You are missing -o before -ServerAliveCountMax. Is this just a copying error?

    – meuh
    2 days ago













1












1








1








I experienced this strange behavior with rsync command:



sudo rsync --timeout=300 --compress-level=9 -aHe "ssh -o ConnectTimeout=200 -o ServerAliveInterval=2 -ServerAliveCountMax=200" --progress --delete -z /media/Restic/* root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic


After few minutes, I get the error



rsync: [sender] write error: Broken pipe (32)


I tested with another concurrent ssh session in second terminal window running ping to gateway and it keeps running even when rsync breaks, it just pauses for a while when rsync breaks. It seems to me that Ubuntu kills the connection for a second or two and then resumes.



I wonder why ssh on rsync reports broken pipe immediately and does not wait for timeout 200 or 300 that I have set up in the command.










share|improve this question









New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I experienced this strange behavior with rsync command:



sudo rsync --timeout=300 --compress-level=9 -aHe "ssh -o ConnectTimeout=200 -o ServerAliveInterval=2 -ServerAliveCountMax=200" --progress --delete -z /media/Restic/* root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic


After few minutes, I get the error



rsync: [sender] write error: Broken pipe (32)


I tested with another concurrent ssh session in second terminal window running ping to gateway and it keeps running even when rsync breaks, it just pauses for a while when rsync breaks. It seems to me that Ubuntu kills the connection for a second or two and then resumes.



I wonder why ssh on rsync reports broken pipe immediately and does not wait for timeout 200 or 300 that I have set up in the command.







ubuntu ssh rsync






share|improve this question









New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









fra-san

2,0211620




2,0211620






New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









JanJan

61




61




New contributor




Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







  • 1





    You are missing -o before -ServerAliveCountMax. Is this just a copying error?

    – meuh
    2 days ago












  • 1





    You are missing -o before -ServerAliveCountMax. Is this just a copying error?

    – meuh
    2 days ago







1




1





You are missing -o before -ServerAliveCountMax. Is this just a copying error?

– meuh
2 days ago





You are missing -o before -ServerAliveCountMax. Is this just a copying error?

– meuh
2 days ago










1 Answer
1






active

oldest

votes


















0














The --timeout option is used to handle situations where the remote rsync has hung or otherwise become unavailable. It means "wait for this many seconds before giving up on the remote connection".



If the connection is forcibly closed, as in your scenario, there is no longer any connection and rsync can no longer communicate with its peer. Since it can now guarantee it will never hear from its peer it gives up and reports an error to you immediately.



Ideally you should investigate why your server is closing connections indiscriminately. In the meantime putting a loop around the transfer process may help



while :
do
rsync ... /media/Restic/ root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic &&
break
ss=$?

[[ -t 2 ]] && echo "Rsync failed with status $ss; retrying..." >&2
sleep 60
done





share|improve this answer

























  • Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

    – Jan
    2 days ago











  • @Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

    – roaima
    2 days ago











Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Jan is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510469%2fssh-timeout-with-rsync-and-ubuntu-18-10%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














The --timeout option is used to handle situations where the remote rsync has hung or otherwise become unavailable. It means "wait for this many seconds before giving up on the remote connection".



If the connection is forcibly closed, as in your scenario, there is no longer any connection and rsync can no longer communicate with its peer. Since it can now guarantee it will never hear from its peer it gives up and reports an error to you immediately.



Ideally you should investigate why your server is closing connections indiscriminately. In the meantime putting a loop around the transfer process may help



while :
do
rsync ... /media/Restic/ root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic &&
break
ss=$?

[[ -t 2 ]] && echo "Rsync failed with status $ss; retrying..." >&2
sleep 60
done





share|improve this answer

























  • Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

    – Jan
    2 days ago











  • @Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

    – roaima
    2 days ago















0














The --timeout option is used to handle situations where the remote rsync has hung or otherwise become unavailable. It means "wait for this many seconds before giving up on the remote connection".



If the connection is forcibly closed, as in your scenario, there is no longer any connection and rsync can no longer communicate with its peer. Since it can now guarantee it will never hear from its peer it gives up and reports an error to you immediately.



Ideally you should investigate why your server is closing connections indiscriminately. In the meantime putting a loop around the transfer process may help



while :
do
rsync ... /media/Restic/ root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic &&
break
ss=$?

[[ -t 2 ]] && echo "Rsync failed with status $ss; retrying..." >&2
sleep 60
done





share|improve this answer

























  • Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

    – Jan
    2 days ago











  • @Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

    – roaima
    2 days ago













0












0








0







The --timeout option is used to handle situations where the remote rsync has hung or otherwise become unavailable. It means "wait for this many seconds before giving up on the remote connection".



If the connection is forcibly closed, as in your scenario, there is no longer any connection and rsync can no longer communicate with its peer. Since it can now guarantee it will never hear from its peer it gives up and reports an error to you immediately.



Ideally you should investigate why your server is closing connections indiscriminately. In the meantime putting a loop around the transfer process may help



while :
do
rsync ... /media/Restic/ root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic &&
break
ss=$?

[[ -t 2 ]] && echo "Rsync failed with status $ss; retrying..." >&2
sleep 60
done





share|improve this answer















The --timeout option is used to handle situations where the remote rsync has hung or otherwise become unavailable. It means "wait for this many seconds before giving up on the remote connection".



If the connection is forcibly closed, as in your scenario, there is no longer any connection and rsync can no longer communicate with its peer. Since it can now guarantee it will never hear from its peer it gives up and reports an error to you immediately.



Ideally you should investigate why your server is closing connections indiscriminately. In the meantime putting a loop around the transfer process may help



while :
do
rsync ... /media/Restic/ root@192.168.0.2:/DataVolume/BACKUPS/T4-Ubuntu-Restic &&
break
ss=$?

[[ -t 2 ]] && echo "Rsync failed with status $ss; retrying..." >&2
sleep 60
done






share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered 2 days ago









roaimaroaima

46k758124




46k758124












  • Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

    – Jan
    2 days ago











  • @Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

    – roaima
    2 days ago

















  • Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

    – Jan
    2 days ago











  • @Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

    – roaima
    2 days ago
















Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

– Jan
2 days ago





Thanks for suggestion. I was thinking of this solution, but I first need to set up ssh root on NAS for key-only authentication. I can only use root user, so I am a bit struggling, because tutorials suggest to turn off password for root completely which I can not do. I need that root can be authenticated by password OR a key, not by key only.

– Jan
2 days ago













@Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

– roaima
2 days ago





@Jan if you want password and your destination username is root you need first to disable the "disallow root" setting in /etc/ssh/sshd_config and then set a password for the account. To enable the key, take your source user's id_rsa.pub file and append its one-line contents to the destination user's file .ssh/authorized_keys (create the file if necessary).

– roaima
2 days ago










Jan is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















Jan is a new contributor. Be nice, and check out our Code of Conduct.












Jan is a new contributor. Be nice, and check out our Code of Conduct.











Jan is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Unix & Linux Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f510469%2fssh-timeout-with-rsync-and-ubuntu-18-10%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

getting Checkpoint VPN SSL Network Extender working in the command lineHow to connect to CheckPoint VPN on Ubuntu 18.04LTS?Will the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayVPN SSL Network Extender in FirefoxLinux Checkpoint SNX tool configuration issuesCheck Point - Connect under Linux - snx + OTPSNX VPN Ububuntu 18.XXUsing Checkpoint VPN SSL Network Extender CLI with certificateVPN with network manager (nm-applet) is not workingWill the Linux ( red-hat ) Open VPNC Client connect to checkpoint or nortel VPN gateways?VPN client for linux machine + support checkpoint gatewayImport VPN config files to NetworkManager from command lineTrouble connecting to VPN using network-manager, while command line worksStart a VPN connection with PPTP protocol on command linestarting a docker service daemon breaks the vpn networkCan't connect to vpn with Network-managerVPN SSL Network Extender in FirefoxUsing Checkpoint VPN SSL Network Extender CLI with certificate

Cannot Extend partition with GParted The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) 2019 Community Moderator Election ResultsCan't increase partition size with GParted?GParted doesn't recognize the unallocated space after my current partitionWhat is the best way to add unallocated space located before to Ubuntu 12.04 partition with GParted live?I can't figure out how to extend my Arch home partition into free spaceGparted Linux Mint 18.1 issueTrying to extend but swap partition is showing as Unknown in Gparted, shows proper from fdiskRearrange partitions in gparted to extend a partitionUnable to extend partition even though unallocated space is next to it using GPartedAllocate free space to root partitiongparted: how to merge unallocated space with a partition

Marilyn Monroe Ny fiainany manokana | Jereo koa | Meny fitetezanafanitarana azy.