I have set up some crob tasks in the hosting provider to schedule a daily file backups with the following command:
tar fczv bkup.tar.gz /home/public_html/site/×
But the email I setup in the cpanel received the error message from the system after the command above ran. The error message is “tar: Removing leading ‘/’ from member names”.
I understand that it is actually a tar feature, not a problem. Archives with absolute locations are a security risk. Attackers could use such archives to trick users into installing files in critical system locations. And the message I received is only a STDERR warning, since the backup job still completed.
To avoid such annoying message, I use the “-C” switch to change the command running path, then the leading “/” could be removed from the source path.
It is hard for me to switch to the root directory, I use the “~” home directory instead. So my updated command is changed to the following:
tar fczv bkup.tar.gz -C ~/ home/public_html/site/×
I tried and it worked. Have fun.