1752681 Members
5496 Online
108789 Solutions
New Discussion юеВ

File owner is a number

 
SOLVED
Go to solution
C_V
Frequent Advisor

File owner is a number

Hey guys it is my understanding that when i file is owned by a numerical value the user has been deleted in the system. I check 1 particular file and its owned by 0 in which it is root as per the /etc/passwd the root uid is 0. then i saw other files in which the owner is 50 but i cant find any user with uid of 50. Any thoughts about this?
10 REPLIES 10
Andres_13
Respected Contributor
Solution

Re: File owner is a number

Hi, could you post an example, maybe ll output?

Regards!
Patrick Wallek
Honored Contributor

Re: File owner is a number

If the file has a number as an owner, then that is/was the UID of the user that own(s/ed) the file.

It is the UID and GID that is stored by the system to keep track of the owner and group of files. Commands like 'ls' use /etc/passwd and /etc/group to 'map' UID/GID to actual user and group names.

There are 2 cases that can cause you to see something like this:

1) The user has been deleted from the system. In this case the 'ls' command has no map (no entry in /etc/passwd) to correlate a UID to an actual user name.

2) If the permissions of the /etc/passwd file are too restrictive (if it is not readable by all, ie. at least 444 permissions) then a user may not have rights to read the file. In this case the user will see the UID as the owner for ALL files.



Dennis Handly
Acclaimed Contributor

Re: File owner is a number

>but i cant find any user with uid of 50.

As mentioned, there are several ways this could happen.
1) User deleted. (Patrick)
2) You have installed numeric user/group names
3) Your NIS is bonkers.
4) pwgrd(1M) is broken?
5) Permission problems (Patrick)

You may fix 3) by:
/sbin/init.d/nis.client stop
/sbin/init.d/nis.client start
Bill Hassell
Honored Contributor

Re: File owner is a number

The reality is that all files are owned by numbers. That is all HP-UX needs for opwner and group. But to make things a bit more friendly, the passwd and group files translate the number into a name. You can create a file and assign it any number (within the owner/group limits) like this:

chown 1234:5678 myfile

In 'normal' operations, ownership is usually assigned using names (user and group), so possibly in the past, there was a user with an ID of 50, but the user was removed or the user's ID was changed (not a good idea but certainly can be done).

Now you said that you saw a file with an owner of 0 (I am assuming you are using ls -l). Since root must exist on a stable Unix system, if you see 0, then either root's user ID has been modified in /etc/passwd (big oops) or /etc/passwd has been 'protected' by removing read capability (a very bad idea). /etc/passwd and /etc/group must always be readable by everyone.


Bill Hassell, sysadmin
Analyst
Trusted Contributor

Re: File owner is a number

Hi Nakihid,

>File owner is number.

As the previous writers ,mentioned.

When the user is deleted it retains with the UID, for tracking purpose.

Check the /etc/passwd entries , whether any changes happened.

check for any user modification/deletion.

see the example :-
drwxr-xr-x 2 500 test 96 Dec 3 06:53 user
-rw-r--r-- 1 500 test 0 Dec 3 06:53 ppp

Thanks,
Analyst.
Venkatesh BL
Honored Contributor

Re: File owner is a number

One more possiblity: Even if you have changed the user id of a user, the file will contain the old userid only.

Ex:-

OLD: (uid of c2user1 = 7569)
-rw-rw-rw- 1 c2user1 c2grp 0 Dec 3 08:45 aaaa



NEW:
-rw-rw-rw- 1 7569 c2grp 0 Dec 3 08:45 aaaa

As you can see, the uid on the file still refers to the old one.
Jozef_Novak
Respected Contributor

Re: File owner is a number

Hello,

this can also happen if the file was copied over from another system and the user that owned the file on the original system does not exist on the new one. In this case, the hint would be obvious, just create the user on the new system as well.

Jozef
C_V
Frequent Advisor

Re: File owner is a number

Thanks for the replies guys!:)
Steven Schweda
Honored Contributor

Re: File owner is a number

> [...] all files are owned by numbers.

Exactly.

> As you can see, the uid on the file still
> refers to the old one.

Of course it does. The file owner is a
number, and you change that number, for that
file, using chown. Changing which user name
(if any) is associated with that number has
no effect on any file's owner (number).