{"id":336244,"date":"2022-07-27T15:00:22","date_gmt":"2022-07-27T15:00:22","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336244"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336244","title":{"rendered":"<span>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b tar \u043f\u043e \u0441\u0435\u0442\u0438 \u0447\u0435\u0440\u0435\u0437 SSH<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/678822\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nt\/3m\/yc\/nt3mycynkatnvh-kdoxov3fkzzs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/nt\/3m\/yc\/nt3mycynkatnvh-kdoxov3fkzzs.png\"\/><\/div>\n<p><\/a><br \/>  GNU-\u0432\u0435\u0440\u0441\u0438\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>tar<\/code>, \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0435\u0451 \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 <code>ssh<\/code>. \u041e\u0442 <code>telnet<\/code>\/<code>nc<\/code> \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u044b \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0430\u043d\u0430\u043b\u043e\u0432 (pipe) Unix\/Linux, \u0438 \u043d\u0438\u0436\u0435 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0440\u044f\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>tar<\/code> \u043f\u043e <code>ssh<\/code> \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Linux, BSD\/macOS \u0438\u043b\u0438 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. <a name=\"habracut\"><\/a><\/p>\n<h2><font color=\"#3AC1EF\">\u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f tar \u043f\u043e SSH<\/font><\/h2>\n<p>  \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0445\u043e\u0441\u0442\u043e\u043c <code>box<\/code> \u043f\u043e <code>ssh<\/code> \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 <code>tar<\/code>:<\/p>\n<pre><code class=\"bash\">$ ssh user@box tar czf - \/dir1\/ > \/destination\/file.tar.gz<\/code><\/pre>\n<p>  \u043b\u0438\u0431\u043e:<\/p>\n<pre><code class=\"bash\">$ ssh user@box 'cd \/dir1\/ &amp;&amp; tar -cf - file | gzip -9' >file.tar.gz<\/code><\/pre>\n<p>  \u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0440\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 <code>\/wwwdata<\/code> \u043d\u0430 \u0445\u043e\u0441\u0442\u0435 <code>dumpserver.nixcraft.in (IP 192.168.1.201)<\/code> \u043f\u043e <code>ssh<\/code>:<\/p>\n<pre><code class=\"bash\"># tar zcvf - \/wwwdata | ssh user@dumpserver.nixcraft.in \"cat > \/backup\/wwwdata.tar.gz\"<\/code><\/pre>\n<p>  \u043b\u0438\u0431\u043e:<\/p>\n<pre><code class=\"bash\"># tar zcvf - \/wwwdata | ssh vivek@192.168.1.201 \"cat > \/backup\/wwwdata.tar.gz\"<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0437\u0435\u0446 \u0432\u044b\u0432\u043e\u0434\u0430:<\/p>\n<pre><code class=\"bash\">tar: Removing leading `\/' from member names \/wwwdata\/ \/wwwdata\/n\/nixcraft.in\/ \/wwwdata\/c\/cyberciti.biz\/ .... .. ... Password:<\/code><\/pre>\n<p>  \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u0443\u0435\u043c <code>\/data2\/<\/code>, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <code>gpg<\/code>:<\/p>\n<pre><code class=\"bash\">$ tar zcf - \/data2\/ | gpg -e | ssh vivek@nas03 'cat - > data2-dd-mm-yyyy.tar.gz.gpg'<\/code><\/pre>\n<p>  \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 <code>sudo<\/code> \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0435\u0439 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438 \u043f\u0441\u0435\u0432\u0434\u043e-\u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430, \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430:<\/p>\n<pre><code class=\"bash\">sudo: sorry, you must have a tty to run sudo<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0435\u0451 \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>ssh<\/code> \u0444\u043b\u0430\u0433\u043e\u043c <code>-t<\/code>:<\/p>\n<pre><code class=\"bash\"># tar zcvf - \/wwwdata | ssh -t vivek@192.168.1.201 \"sudo cat > \/backup\/wwwdata.tar.gz\"<\/code><\/pre>\n<p>  \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b (<code>server1.cyberciti.biz<\/code>) \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">$ cd \/path\/local\/dir\/ $ ssh vivek@server1.cyberciti.biz 'tar zcf - \/some\/dir' | tar zxf -<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0420\u0435\u0437\u0435\u0440\u0432\u043d\u043e\u0435 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\/\u0437\u0435\u0440\u043a\u0430\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0436\u0451\u0441\u0442\u043a\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u043f\u043e\u0434 Linux<\/font><\/h3>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043b\u044f \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0441\u0435\u0433\u043e HDD <code>\/dev\/sdvf<\/code> \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0430 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0439 \u0431\u044d\u043a\u0430\u043f-\u0441\u0435\u0440\u0432\u0435\u0440 AWS EC2:<\/p>\n<pre><code class=\"bash\"># dd if=\/dev\/sdvf | ssh backupimg@vpc-aws-mumbai-backup-001 'dd of=prod-disk-hostname-sdvf-dd-mm-yyyy.img'<\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043a\u0430 \u0438\u0437 \u043e\u0431\u0440\u0430\u0437\u0430 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0432\u0435\u0440\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435, \u0442\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\"># ssh backupimg@vpc-aws-mumbai-backup-001 'dd if=prod-disk-hostname-sdvf-dd-mm-yyyy.img' | dd of=\/dev\/sdvf<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0435\u0440\u0435\u043d\u043e\u0441 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 Linux<\/font><\/h3>\n<p>  \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 <code>scp<\/code> \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438, \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0449\u0438\u043c\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u0432, \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438, \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u0441\u043e\u043a\u0435\u0442\u044b, \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u0430\u043d\u0430\u043b\u044b \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043d\u0435 \u043a\u043e\u043f\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c <code>tar<\/code> \u043f\u043e <code>ssh<\/code>. \u0421\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0432\u0441\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 <code>nuc-box<\/code>.<\/p>\n<p>  \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>ssh<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 <code>tar<\/code>:<\/p>\n<pre><code class=\"bash\">$ ssh vivek@nuc-box 'tar czf - \/home\/vivek' | tar xvzf - -C \/home\/vivek<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 tar \u043f\u043e SSH \u043a \u043b\u0435\u043d\u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044e<\/font><\/h3>\n<p>  \u0412 Linux \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0435\u0440\u0432\u044b\u043c \u043b\u0435\u043d\u0442\u043e\u0447\u043d\u044b\u043c \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0435\u043c SCSI \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <code>\/dev\/st0<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0438 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u043a\u0438\u0445 \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u0435\u0439 \u0432 Linux \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.cyberciti.biz\/faq\/tape-drives-naming-convention-under-linux\/\">\u0437\u0434\u0435\u0441\u044c (\u0430\u043d\u0433\u043b.)<\/a>. \u0414\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u044f\u0441\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>dd<\/code>:<\/p>\n<pre><code class=\"bash\"># tar cvzf - \/wwwdata | ssh root@192.168.1.201 \"dd of=\/backup\/wwwdata.tar.gz\"<\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0431\u044d\u043a\u0430\u043f \u043d\u0430 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0435 \u043b\u0435\u043d\u0442\u043e\u0447\u043d\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e:<\/p>\n<pre><code class=\"bash\"># tar cvzf - \/wwwdata | ssh root@192.168.1.201 \"cat > \/dev\/nst0\"<\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>mt<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043e\u0442\u0430\u0442\u044c \u043f\u043b\u0451\u043d\u043a\u0443, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043d\u0435\u0451 \u0434\u0430\u043c\u043f \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>cat<\/code>:<\/p>\n<pre><code class=\"bash\"># tar cvzf - \/wwwdata | ssh root@192.168.1.201 $(mt -f \/dev\/nst0 rewind; cat > \/dev\/nst0)$<\/code><\/pre>\n<p>  <\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0418\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u0435 tar \u043f\u043e SSH<\/font><\/h3>\n<p>  \u0421\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0432\u0435\u0441\u044c\u043c\u0430 \u043f\u0440\u043e\u0441\u0442:<\/p>\n<pre><code class=\"bash\">$ cat my-data.tar.gz | ssh user@server1.cyberciti.biz \"tar zxvf -\" $ cat my-data.tar.gz | ssh user@server1.cyberciti.biz \"cd \/path\/to\/dest\/; tar zxvf -\"<\/code><\/pre>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0431\u044d\u043a\u0430\u043f\u0430 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043f\u043e <code>ssh<\/code>:<\/p>\n<pre><code class=\"bash\"># cd \/ # ssh root@192.168.1.201 \"cat \/backup\/wwwdata.tar.gz\" | tar zxvf -<\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0435\u0448\u0438\u0442\u0435 \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0432 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 <code>cron<\/code> \u0438\u043b\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u0445, \u043f\u043e\u0434\u0443\u043c\u0430\u0439\u0442\u0435 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043b\u044e\u0447\u0435\u0439 <code>ssh<\/code>, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u0438.<\/p>\n<h3><font color=\"#3AC1EF\">\u258d \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 \u0441 \u0438\u043d\u0434\u0438\u043a\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0430<\/font><\/h3>\n<p>  <\/p>\n<blockquote><p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u0430 <code>pv<\/code> \u0432 \u0432\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c. \u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0442\u0430\u043a, \u0442\u043e \u0434\u043b\u044f \u0435\u0451 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>apk<\/code> \u0432 Alpine Linux, <code>dnf<\/code>\/<code>yum<\/code> \u0432 RHEL &amp; co, <code>apt<\/code>\/<code>apt-get<\/code> \u0432 Debian \u0438 Ubuntu &amp; co, <code>zypper<\/code> \u0432 SUSE\/OpenSUSE, <code>pacman<\/code> \u0432 Arch Linux.<\/p><\/blockquote>\n<p>  \u041a\u043e\u043c\u0430\u043d\u0434\u0430 <code>pv<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441 \u043f\u0440\u043e\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e \u043a\u0430\u043d\u0430\u043b\u0443. \u0412\u043e\u0442 \u0435\u0451 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441:<\/p>\n<pre><code class=\"bash\">$ cd \/dir\/to\/backup\/ $ tar zcf - . | pv | ssh vivek@server1.cyberciti.biz \"cat > \/backups\/box42\/backup-dd-mm-yyyy.tgz\" $ cd \/tmp\/data\/ $ tar zcf - . | \\ pv | \\ ssh vivek@centos7 \"cat > \/tmp\/data.tgz\"<\/code><\/pre>\n<p>  <\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/e5\/0u\/ig\/e50uign8qcix4dhkiqclzfdifbs.gif\" data-src=\"https:\/\/habrastorage.org\/webt\/e5\/0u\/ig\/e50uign8qcix4dhkiqclzfdifbs.gif\"\/><\/div>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f tar \u043f\u043e SSH<\/font><\/h2>\n<p>  <\/p>\n<pre><code class=\"bash\">$ tar cvjf - * | ssh vivek@nixcraft \"(cd \/dest\/; tar xjf -)\" $ tar cvzf - mydir\/ | ssh vivek@backupbox \"cat > \/backups\/myfile.tgz\" $ tar cvzf - \/var\/www\/html | ssh vivek@server1.cyberciti.biz \"dd of=\/backups\/www.tar.gz\" $ ssh vivek@box2 \"cat \/backups\/www.tar.gz\" | tar xvzf - $ tar cvjf - * | ssh root@home.nas02 \"(cd \/dest\/; tar xjf - )\"<\/code><\/pre>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043a\u043e\u043c\u0430\u043d\u0434 <code>tar<\/code>\/<code>ssh<\/code>\/<code>bash<\/code> \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>help<\/code> \u0438\u043b\u0438 <code>man<\/code>:<\/p>\n<pre><code class=\"bash\">$ man tar $ man bash $ man ssh<\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435 \u043e\u0431 SSHFS<\/font><\/h2>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>sshfs<\/code> \u043c\u043e\u0436\u043d\u043e \u043c\u043e\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0438 \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c <code>tar<\/code>:<\/p>\n<pre><code class=\"bash\">$ mkdir \/data\/ $ sshfs vivek@server1.cyberciti.biz:\/ \/data\/ $ tar -zcvf \/data\/file.tar.gz \/home\/vivek\/<\/code><\/pre>\n<p>  <\/p>\n<h2><font color=\"#3AC1EF\">\u258d \u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/font><\/h2>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0432\u043a\u0440\u0430\u0442\u0446\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0438\u0441\u044c \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>tar<\/code> \u0432 \u0441\u0435\u0430\u043d\u0441\u0430\u0445 <code>ssh<\/code> \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0430\u0440\u0445\u0438\u0432\u043e\u0432, \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0437\u043e\u0432. \u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0441\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043e\u0431\u0435\u0438\u0445 \u0441\u0442\u043e\u0440\u043e\u043d\u0430\u0445. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">$ tar cvf - \/wwwdata | ssh user@dumpserver.nixcraft.in \"cat > \/backup\/wwwdata.tar\" $ ssh vivek@server1 'tar c .' | tar xvf - -C \/home\/vivek\/<\/code><\/pre>\n<p>  <a href=\"http:\/\/ruvds.com\/ru-rub?utm_source=habr&amp;utm_medium=article&amp;utm_campaign=Bright_Translate&amp;utm_content=ispolzovanie_utility_tar_po_seti_cherez_ssh\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/sz\/7j\/pf\/sz7jpfj8i1pa6ocj-eia09dev4q.png\" data-src=\"https:\/\/habrastorage.org\/webt\/sz\/7j\/pf\/sz7jpfj8i1pa6ocj-eia09dev4q.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/678822\/\"> https:\/\/habr.com\/ru\/company\/ruvds\/blog\/678822\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/ruvds\/blog\/678822\/\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nt\/3m\/yc\/nt3mycynkatnvh-kdoxov3fkzzs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/nt\/3m\/yc\/nt3mycynkatnvh-kdoxov3fkzzs.png\"\/><\/div>\n<p><\/a><br \/>  GNU-\u0432\u0435\u0440\u0441\u0438\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f <code>tar<\/code>, \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0435\u0451 \u0441\u0442\u0430\u0440\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 <code>ssh<\/code>. \u041e\u0442 <code>telnet<\/code>\/<code>nc<\/code> \u0441\u0442\u043e\u0438\u0442 \u043e\u0442\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e\u0442 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f. \u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0445\u0438\u0432\u044b \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u0430\u043d\u0430\u043b\u043e\u0432 (pipe) Unix\/Linux, \u0438 \u043d\u0438\u0436\u0435 \u044f \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0440\u044f\u0434 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>tar<\/code> \u043f\u043e <code>ssh<\/code> \u0434\u043b\u044f \u0430\u0440\u0445\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 Linux, BSD\/macOS \u0438\u043b\u0438 Unix-\u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336244","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336244","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336244"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336244\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336244"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}