LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-23-2009, 01:01 PM   #1
aloktiagi
LQ Newbie
 
Registered: Jul 2009
Posts: 20

Rep: Reputation: 0
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
 
Old 10-23-2009, 01:20 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
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.

Last edited by acid_kewpie; 10-23-2009 at 01:21 PM.
 
Old 10-23-2009, 11:56 PM   #3
aloktiagi
LQ Newbie
 
Registered: Jul 2009
Posts: 20

Original Poster
Rep: Reputation: 0
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
 
Old 10-24-2009, 01:20 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set getpwnam to read a file instead /etc/shadow file ZAMO Linux - General 1 02-02-2009 09:25 AM
Shadow file honey bee Linux - Newbie 4 01-05-2008 04:14 AM
http file last modified rigel_kent Programming 1 06-18-2006 01:51 PM
shadow file os2 Linux - Security 3 10-18-2005 04:20 PM
vi won't save modified file. mimsmall Linux - General 1 03-26-2004 11:04 PM


All times are GMT -5. The time now is 03:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration