0
garrett@mint-desktop /var/www/html/udemy/php-oop/gallery/backups $ tar --exclude-tag-all=backups -cf lesson20.tar ../*
tar: Removing leading `../' from member names

I have an empty file called backups in my backups directory to keep the tar file from trying to backup itself. Does anyone know why I'm getting this output?

-> tar: Removing leading ../' from member names Note that there was a backtick between leading and ../ .

3
Contributors
5
Replies
49
Views
2 Years
Discussion Span
Last Post by Gribouillis
2

You can disable tar's removal of absolute paths (including, but not limited to '/' and '../'). It does that so that when you extract the files from the tarball it doesn't overwrite stuff you don't intend it to. It will extract the files, by default, into the local directory where you run the command from - not where the tarball is. Overwriting this default behavior of tar is VERY dangerous can can easily bork your system, permanently! Better to extract stuff to the current directory (and DO NOT do that from the root directory, or as the root user!) and then move it as necessary. If you are the root user, it will preserve ownership and permissions of the extracted files and directories. Again, MAKE SURE you are not in the root (/) directory, or other sensitive places such as /etc, etc... :-)

0

I'm not running this command from /, or as root. I'm trying to backup the web project that I'm doing from the onine udemy class and it's stored at /var/www/html/udemy/php-oop/gallery/ inside that directory I have a backup directory where I'm trying to store all of my tar balls of the web project as I progress through the lessons and making changes to the project. /var/www/html/udemy/php-oop/gallery/backups/ I want to tar everything under gallery except the backups directory itself. I ran the command tar --exclude-tag-all=backups -cf lesson21.tar ../* from inside the backukps directory that's under the gallery directory. And to get the exclude option to work I created an empty file inside backups directory called, well backups. I'm suing relative paths with this command ../ .
So do I have anything to worry about using relative paths in this sense or from the tar output mentioned above? Thanks rubberman. I thank you've answered more of my questions here on Daniweb than most of my replies combined.

1

I think you are creating a tar bomb, a tar archive that explodes into many files instead of creating a single directory. Can't you try

tar --exclude-tag-all=backups -C ../.. -cf lesson21.tar gallery
0

Okay, what will that do? I know when I run tar tvf lessonxx.tar on my tar files that it does list everything inside so it seems to be creating a tar fall will everything I want inside. I'm just wondering about that omitting ../ output.
Gribouillis, you're the other user who's always answered a lot of my posts. Thanks.

0

Okay, what will that do?

  1. You won't have the error message any more
  2. Your tar file would contain a single directory named gallery
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.