LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 11-26-2008, 01:05 PM   #1
vineet7kumar
Member
 
Registered: Aug 2005
Posts: 75

Rep: Reputation: 15
unexpected behavior while installing flock


I am using Ubuntu Hardy. I downloaded Flock tar.bz2 as user 'vineet'
I copied it to /opt
after copying and extracting there in opt the owner was changed to another user 'bhoot'.
Whereas where I actually downloaded there it's owner is 'vineet' only.
Why is the owner changed automatically?
Also I am unable to run flock-browser ...

Any help regarding this would be great.

Regards,
Vineet
 
Old 11-26-2008, 01:12 PM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
It could have changed owners due to extraction or just that it inherited the permissions from the /opt filesystem. Just guessing though. Did you give any extra parameters when extracting the file?
 
Old 11-27-2008, 09:18 AM   #3
vineet7kumar
Member
 
Registered: Aug 2005
Posts: 75

Original Poster
Rep: Reputation: 15
something more

Hi,
Today I tried same thing with xmms tar.gz package . After extracting it made some other user '500' as it's owner ... What is this '500' username for ??
Is it an issue with tar command?
Any other ubuntu user please try it out .

Thanks and Regards,
Vineet
 
Old 11-27-2008, 09:23 AM   #4
vineet7kumar
Member
 
Registered: Aug 2005
Posts: 75

Original Poster
Rep: Reputation: 15
I don't have any username as '500' in the /etc/passwd file nor does any user have a userid 500 .
 
Old 11-27-2008, 09:43 AM   #5
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
post what you are typing in when untaring the package.
 
Old 11-28-2008, 09:59 AM   #6
vineet7kumar
Member
 
Registered: Aug 2005
Posts: 75

Original Poster
Rep: Reputation: 15
The package names are (in /opt)

flock_afc052961B81660-2.0.en-US.linux-i686.tar (owner root)

and

xmms-1.2.11.tar (owner root)


The command I am giving are

Code:
sudo tar -xvf flock_afc052961B81660-2.0.en-US.linux-i686.tar
and

Code:
sudo tar -xvf xmms-1.2.11.tar

after doing this the output of my ls -l command is as below

Code:
drwxr-xr-x 13 bhoot bhoot     4096 2008-10-07 21:41 flock
drwxrwxrwx 12   500   500     4096 2008-11-27 20:47 xmms-1.2.11
-rwxrwxrwx  1 root  root        65 2008-11-26 21:48 connect
-rw-------  1 root  root  37099520 2008-11-27 00:01 flock_afc052961B81660-2.0.en-US.linux-i686.tar
-rw-r--r--  1 root  root  15504764 2008-11-27 20:36 skype-debian_2.0.0.72-1_i386.deb
-rw-r--r--  1 root  root  17285120 2008-11-27 20:45 xmms-1.2.11.tar

do let me know if I should provide something more.

Thanks and regards,
Vineet
 
Old 11-28-2008, 11:12 AM   #7
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 367Reputation: 367Reputation: 367Reputation: 367
tar was originally used for making tape archives, for backups.
It bundles up all the files in a directory and saves them in one big file: The tar file.
Along with the files themselves, it also saves data about who the files belonged to, and what group they were assigned to, and a lot of other useful stuff as well (time created, time modified etc.)

[This tar file can also be compressed.]

If you untar a tar file as the user root, then the directories and files will reappear, but with the original owner (UID) and group IDs (GIDs). These are just numbers.
If you untar a tar file as yourself, tar will automatically assign yourself as the owner of the untarred files, and the group assigned to the files will be your default group.

Because you untarred as root the original UID and GID will be assigned to the files.

Linux looks up these numbers in /etc/passwd and /etc/groups and then converts these numbers to username and groupname if it can. If it can't then it'll just show the number instead of a username or groupname.

So.... Someone with a username of bhoot on your machine has the same UID and GID numbers as the user who owned the original flock directory before it was tarred up and you downloaded it.
That's why the user & group are listed as bhoot for the flock directory.

But xmms-1.2.11 was tarred up by someone with a UID of 500 and a GID of 500.
You do not have any users or groups on your machine corresponding to these numbers, so linux cannot look them up, and it just prints the numbers.

Please see man chown for how to change the owner:group of files and man tar for the very many options for the tar command.

Last edited by tredegar; 11-28-2008 at 11:14 AM.
 
Old 11-28-2008, 01:52 PM   #8
vineet7kumar
Member
 
Registered: Aug 2005
Posts: 75

Original Poster
Rep: Reputation: 15
Wow ... very informative stuff... Thanks a Lot


Thanks & Regards,
Vineet
 
Old 11-29-2008, 12:59 AM   #9
jstephens84
Senior Member
 
Registered: Sep 2004
Distribution: (Home)Opensolaris, Ubuntu, CentOS, (Work - AIX, HP-UX, Red Hat)
Posts: 2,043

Rep: Reputation: 83
Quote:
Originally Posted by tredegar View Post
tar was originally used for making tape archives, for backups.
It bundles up all the files in a directory and saves them in one big file: The tar file.
Along with the files themselves, it also saves data about who the files belonged to, and what group they were assigned to, and a lot of other useful stuff as well (time created, time modified etc.)

[This tar file can also be compressed.]

If you untar a tar file as the user root, then the directories and files will reappear, but with the original owner (UID) and group IDs (GIDs). These are just numbers.
If you untar a tar file as yourself, tar will automatically assign yourself as the owner of the untarred files, and the group assigned to the files will be your default group.

Because you untarred as root the original UID and GID will be assigned to the files.

Linux looks up these numbers in /etc/passwd and /etc/groups and then converts these numbers to username and groupname if it can. If it can't then it'll just show the number instead of a username or groupname.

So.... Someone with a username of bhoot on your machine has the same UID and GID numbers as the user who owned the original flock directory before it was tarred up and you downloaded it.
That's why the user & group are listed as bhoot for the flock directory.

But xmms-1.2.11 was tarred up by someone with a UID of 500 and a GID of 500.
You do not have any users or groups on your machine corresponding to these numbers, so linux cannot look them up, and it just prints the numbers.

Please see man chown for how to change the owner:group of files and man tar for the very many options for the tar command.
Very nice explanation. I always thought it took the permissions straight from the directory.
 
  


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
Usage of struct in C++ caused unexpected behavior phugoid Programming 5 04-29-2006 04:46 PM
flock problem climbingmerlin Programming 3 10-20-2005 09:36 AM
flock and touch Arcades Programming 6 03-11-2005 08:13 PM
odd behavior with dpkg-reconfigure when installing new card? michapma Debian 5 10-27-2004 09:37 AM
Unexpected Behavior (passwd command) Penguin666 Linux - General 3 11-19-2003 11:34 PM


All times are GMT -5. The time now is 01:13 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration