Compress Tar Files and Directory with Permissions

RegisterLogin
Compress Tar Files and Directory with Permissions
Post Description: Compress Tar Files and Directory with Permissions
Tags: Compress, Tar, Files, and, Directory, with, Permissions
This Post Was Posted On Feb 29, 2008 By marvin #2089
Sometimes I need to compress and make backups of files and directories. but when I uncompress the tar.gz file, the owner and group permissions change to root.

I found a way to keep (retain) the group and user permssions with this command:

example: suppose i want to make a backup copy of my public_html directory which is located at /var/www/html/ and want to compress it retaining the files group and user owership permissions. so to backup my public_html (/var/www/html/public_html) i would move to the html directory:

change directory to where the to be tar file is located:

     Code:
cd var/www/html


[ This post sponsered by www.webune.com ]
post picture

now execute this command to do the compressing of public_html

     Code:
tar -pczf public_html.tar.gz public_html/
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2011 Webune Forums - Thu Dec 22, 2011 5:48 pm
Powered by: Webune Forums V3