Surprisingly, I see quite a few questions around file ownership asked all the time. And one of the first questions asked concerns the Unix user who owns a particular file.
It's very easy to confirm who the owner of a file is, and you can do it using the ls command.
Find the owner of a file
Using -l command line option, you make ls return the output in a long format. And two fields in each line of the output are showing you the username and the group name which file belongs to.
In this example, we can see that /etc/passwd belongs to a user root and a unix group called root:
ubuntu$ ls -l /etc/passwd -rw-r--r-- 1 root root 1443 Jan 30 16:49 /etc/passwd
And if I look at one of my own files, you can see that it belongs to me (greys) and to my primary unix group (admin):
ubuntu$ ls -l /home/greys/myfile.txt -rw-r--r-- 1 greys admin 0 Mar 20 05:13 /home/greys/myfile.txt
That's it, do you see yourself that it's not rocket science? Do ask questions in the comments if you're still not sure about details!
jos says
find user of file:
ls -l /etc/passwd | cut -d ' ' -f 3
find group of file:
ls -l /etc/passwd | cut -d ' ' -f 4