LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how is shadow file modified (https://www.linuxquestions.org/questions/linux-newbie-8/how-is-shadow-file-modified-763999/)

aloktiagi 10-23-2009 12:01 PM

how is shadow file modified
 
how is the shadow file modified when its permissions are -r--------

i know that when passwd is executed the user is set to root
priveleges by setuid(), but how does passwd modify the shadow file

thank you

acid_kewpie 10-23-2009 12:20 PM

root doesn't have to obey posix filesystem rights, it's happy to override them if that's what the code says. What it can't / won't, to my knowledge, get around is if the file is set to be immutable (chattr +i /etc/shadow). I guess it's set as not writable by default as it's never meant to be manually edited, but can be if you really need to.

aloktiagi 10-23-2009 10:56 PM

how is shadow file written to
 
so if i login as root can i change the shadow file using vi or you meant kernel instead of rootwhich can modify the file

thank you

acid_kewpie 10-24-2009 12:20 AM

yeah, you'll need a :w! to force a write, but it's easy enough in vi.


All times are GMT -5. The time now is 10:46 AM.