RHEL7: Getting "tar: write error" message when untaring from a pipe executing "ssh" command

Solution Verified - Updated -

Issue

  • When executing a tar command piped from a ssh command, the tar command sometimes exits with message tar: write error, as shown in the example below

    $ (ssh -n remotesystem "cd src && tar cf - ." | (cd dst && tar xpvBf -)) 2>&1 | grep "write error"
    tar: write error
    
  • The issue mainly happens when using ksh as user shell. It happens rarely with bash but may happen anyway.

Environment

  • Red Hat Enterprise Linux 7
    • openssh
    • tar
    • ksh or bash

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content