i try to compress with tar a repertory in a chroot environment with ssh, but it failed as it just compress the symbolic link itself, how can I compress it's content ?
我尝试使用ssh在chroot环境中使用tar压缩一个库,但它失败了,因为它只是压缩符号链接本身,我如何压缩它的内容?
-bash-3.00$ ls -ail
1263583 lrwxrwxrwx 1 root root 18 Apr 18 2008 mainwebsite_html -> ../../var/www/html
-bash-3.00$ tar -cjvf archive.tar.bz2 mainwebsite_html
-bash-3.00$ ls -ail
7509101 -rw-r--r-- 1 user1 user1 136 Feb 22 08:57 archive.tar.bz2
1263583 lrwxrwxrwx 1 root root 18 Apr 18 2008 mainwebsite_html -> ../../var/www/html
Thx
谢谢
2 个解决方案
#1
25
From the tar(1)
man page:
从tar(1)手册页:
-h, --dereference follow symlinks; archive and dump the files they point to
#2
18
Take care of placing the "h" option in the correct place. In your example:
注意将“h”选项放在正确的位置。在你的例子中:
tar -cjvf archive.tar.bz2 mainwebsite_html
should be
应该
tar -chjvf archive.tar.bz2 mainwebsite_html
#1
25
From the tar(1)
man page:
从tar(1)手册页:
-h, --dereference follow symlinks; archive and dump the files they point to
#2
18
Take care of placing the "h" option in the correct place. In your example:
注意将“h”选项放在正确的位置。在你的例子中:
tar -cjvf archive.tar.bz2 mainwebsite_html
should be
应该
tar -chjvf archive.tar.bz2 mainwebsite_html