LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2007, 03:56 PM   #1
dfw123
Member
 
Registered: Apr 2007
Posts: 45

Rep: Reputation: 15
tar change user?


Hello!

I login as root when I untar a file,it untar all the files to a folder but that folder's user and group is not root, it changed to other user. why this happen? thanks.
 
Old 05-09-2007, 04:36 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Probably because the tar file specifies a user and group.
Quote:
Originally Posted by tar(1)
-o, --no-same-owner
extract files with owner set to current user (the default for
non-root users)
 
Old 05-09-2007, 05:05 PM   #3
dfw123
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Rep: Reputation: 15
I man tar on fedora 6, it said:

-o, --old-archive, --portability
write a V7 format archive, rather than ANSI format

-O, --to-stdout
extract files to standard output

I command like this tar -xvzf php5.1.6.tar.gz

output :

drwxr-xr-x 14 1002 1002 4096 Aug 23 2006 php-5.1.6

why?
 
Old 05-09-2007, 05:55 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Again, the tar file includes the user and group information. If you extract it as root, that will be preserved unless you use the option not to. Check and see if it has --no-same-owner available.
 
Old 05-09-2007, 06:21 PM   #5
dfw123
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Rep: Reputation: 15
thanks. I get it work.

Last edited by dfw123; 05-10-2007 at 02:00 PM.
 
Old 05-10-2007, 02:08 PM   #6
dfw123
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Rep: Reputation: 15
just curious, I downloaded tar file from php website. It should not include any user and group inside. How come the tar file will use my existing user account ,for example john. I deleted user and group called john then it uses 1002 as user and group?
 
Old 05-10-2007, 02:13 PM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
The user and group are stored numerically as 1002. It is just coincidence that you had a user and group named john with uid/gid 1002.
 
Old 05-10-2007, 02:45 PM   #8
dfw123
Member
 
Registered: Apr 2007
Posts: 45

Original Poster
Rep: Reputation: 15
But the tar file that I downloaded from website should not include a user and group, right? and it will automatically choose a user and group?

Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 09:59 AM
what is the command to make a user change their password after creating a new user? naweenio Linux - Newbie 7 01-05-2005 07:07 AM
How do I change the cursors globaly for a user? and how do I change them in the E-WM? enigma Z Linux - Software 1 09-18-2004 03:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration