21

I run this from a cronjob:

tar -czvf /var/backups/svn.tgz /var/svn/*

That generates this on stderr:

tar: Removing leading `/' from member names

I would like to avoid this because it is not a real error (for me!). I want on stderr only things that I should worry about?

How can I kill that message?

I have the feeling that it is a matter of using the tar -C option but I am not sure and I don't know how.

Thanks for the help,
Dan

1

2 Answers 2

16

your options:

-P, --absolute-names : don't strip leading `/'s from file names

or

-C /

... and a relative path for things to go into the tar, like so:

tar -C / -czvf /var/backups/svn.tgz var/svn/*
4
  • 2
    I don't want -P. I want -C but I can't get it to work.
    – Dan
    Nov 11, 2010 at 15:11
  • 6
    I have found it out: tar -czvf /var/backups/svn.tgz -C / var/svn/
    – Dan
    Nov 11, 2010 at 15:13
  • Borrowing a warning regarding -P from another thread: Archives with absolute locations are a security risk. Attackers could use such archives to trick users into installing files in critical system locations.
    – gmode
    Jul 31, 2019 at 14:00
  • Archives with absolute locations are a security risk. Attackers could use such archives to trick users into installing files in critical system locations.
    – A.B.
    Oct 11, 2019 at 8:58
0

You can write

# ( tar czvf tar.file /path 2>&1 ) >log.file

The message will be written to log.file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .