LinuxQuestions.org
Review your favorite Linux distribution.
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 08-18-2014, 06:36 AM   #1
jayadhanesh
Member
 
Registered: Feb 2009
Location: Bangalore
Posts: 61

Rep: Reputation: 15
File owner


Hi,
I have a tar file. This was copied to my system as root.The ls -l on the tar file shows the owner as root. When I untarred it and did ls -l, instead of root I see
a number for the files that are unatarred. I was expecting the owner for the files
untarred to be root.

Thanks,
D
 
Old 08-18-2014, 06:45 AM   #2
goumba
Senior Member
 
Registered: Dec 2009
Location: New Jersey, USA
Distribution: Debian, Arch
Posts: 1,161
Blog Entries: 7

Rep: Reputation: 328Reputation: 328Reputation: 328Reputation: 328
In short, the user with the UID (user ID) who created your tar file doesn't exit on your system.

Code:
user1:x:9001:50::/home/user1
user2:x:9002:51::/home/user1
user3:x:9003:52::/home/user1
The user ID is the third column.

Suppose I were to create a .tar file containing files created originally by "user1", and give you that file. Now you extract that file, but you have no user with the same user id (9001). As a result, the files will show in a listing as owned by user id "9001" and not a name.

You can fix this with chown, as root (group is optional):

Code:
chown -R user.group

Last edited by goumba; 08-18-2014 at 06:48 AM. Reason: Spelling corrections
 
Old 08-18-2014, 08:39 AM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,434

Rep: Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506Reputation: 1506
When you extract from a tar file as "root", the default is to preserve the permissions and ownership as stored in the archive. You would need to use the "--no-same-owner" option to ignore the saved ownership and leave all files and directories owned by the current user (root).

Last edited by rknichols; 08-18-2014 at 08:40 AM.
 
  


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
Owner of a directory different than file owner problems Guardian-Mage Linux - Server 4 04-24-2009 10:26 AM
Display by File Name, File Size, and File Owner using ls akeenabawa Linux - Newbie 9 08-15-2008 02:21 PM
File owner and File group locked - root deiphage Linux - Hardware 5 02-05-2005 01:30 PM
file permissions and file owner won't change Nadim Slackware 5 11-29-2003 06:03 PM


All times are GMT -5. The time now is 04:23 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration