title: TAR over two hops
body: <p>I need to create a tar and shipped it to my local folder.
  If i can create tar file, i can easily get it on local folder using scp.
  Here problem is at first step: Creating TAR on remote server. Server is accessible only through another remote server (bastion server).</p>
  
  <p>Here is the command i'm using currently:</p>
  
  <pre><code>timestamp="20160226-085856"
  ssh bastion_server -t ssh remote_server "sudo su -c \"cp -r /etc/nginx /home/ubuntu/backup/nginx_26Feb &amp;&amp; cd /home/ubuntu/backup &amp;&amp; tar -C /home/ubuntu/backup -cf backup_nginx-$timestamp.tar ./nginx_26Feb\" " 
  </code></pre>
  
  <p>Here is the error i am getting:</p>
  
  <pre><code>su: invalid option -- 'r'
  Usage: su [options] [LOGIN]
  </code></pre>
  
  <p>Any help here would be great.</p>