When I view properties of a file, the file owner appears as ‘user # 1004’. Why doesn’t it show the user name? I tried asking at #ubuntu but nobody answered.
3 Answers
The file system itself only stores the numeric user and group ID for a file, it does not store the names. The name comes from the running system's /etc/passwd
and /etc/group
.
If you mount the same filesystem on another system, that numeric ID might not correspond to the same user or group name. Or, it may not correspond to any user or group, in which case it will appear only by its number, no matter where you view it.
Another situation in which this may occur is if you have deleted the user or group since the file's ownership information was set.

- 36,774
The user with the ID 1004 doesn't exists (anymore) in your system.
You can check this with
grep ':1004' /etc/passwd
If there is no output, the user with the ID 1004 doesn't exist.
You can take the ownership with this command
sudo chown $USER:$USER file
-
1
-
Sorry if I sometimes don't ask, but I know that you can always roll back if you don't like it – kos Jul 22 '15 at 18:01
-
1
-
There is output, and I have no intention of taking the ownership. However, I am worried about how I cannot see the user name. – yecril15pl Jul 22 '15 at 18:02
-
-
user:1004:1004:User Name:/home/user:/bin/bash
---Sorry if I mistyped, I do not know how to share clipboard.
– yecril15pl Jul 22 '15 at 18:05 -
-
But why can’t I see the user name? (Note: the actual name has been anonymised, of course). – yecril15pl Jul 22 '15 at 18:49
-
@yecril15pl: how to simulate this: create user1, create file1, create user2, create file2, delete user1 and leave file1 in place... That's what happened. – Fabby Jul 23 '15 at 19:40
-
The reasons this happens is because the owner member of that group was deleted by you or was deleted. This user previously had permissions to the said folder. However, since the user doesn't exist anymore, the permissions for owner show the id but not the name as a remnant metadata.
You can just type id
into your terminal and it will give you all the groups available with their owners.

- 161
{ ls -l; }
prints the user name all right. – yecril15pl Jul 22 '15 at 17:58