PDA

View Full Version : [SOLVED] Default File ownership



shrek1
24th March 2012, 09:02 PM
Hello, I am using Fedora 16. I don't remember how it happened but now when ever a new file i create being normal user , default owner of that file become root instead of that user. what setting i need to change so it become normal again ?

jpollard
24th March 2012, 09:32 PM
check the /etc/passwd file. Your login name should not have a uid or gid of 0.

If this is the case, make sure that you did not just change the name of the root login, as removing that from the real root user will make the system unmaintainable.

shrek1
25th March 2012, 07:34 AM
Thanks for Your answer jpollard , I checked /etc/passwd file. but Only root have uid 0 . Other login account which i usually use has got uid and gid 1000 . So it seems fine to me.

JEO
25th March 2012, 09:23 AM
What do you get when you type "id" in a terminal?

You should check the permissions on /etc/passwd and /etc/shadow and maybe /etc/group. (/etc/shadow should be accessible by no one) Review the contents of those files for any corrupted lines also.

shrek1
25th March 2012, 05:53 PM
I got it . I had set suid bit for vim . Because of this I /etc/shadow file could be open by every login .
Now removing suid bit solved the problem .
Thanks JEO and jpollard for reply.

But i got confuse here , How setting suid bit changed the default ownership of file ?

Dutchy
25th March 2012, 06:34 PM
That's what the suid bit does.
Suid runs the program with the bit set with the permissions of the owner (in this case root).
So any file made with it gets root as the owner.