LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-08-2012, 01:21 PM   #1
aol.aman
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Rep: Reputation: 0
Hi - permission of /etc/shadow is -r--------. when a user changes his / her password.


Hi - permission of /etc/shadow is -r--------. when a user changes his / her password, how /etc/shadow password is updated? Is it due to GID / UID set on this file? Also, /etc/shadow file is a soft link, which is the actual file? Is it /etc/passwd?

Kindly assist.
 
Old 02-08-2012, 03:33 PM   #2
droyden
Member
 
Registered: Feb 2007
Location: UK
Posts: 150

Rep: Reputation: 19
Passwd binary is suid root thus it can open the file r/w
 
1 members found this post helpful.
Old 02-08-2012, 03:55 PM   #3
Marios Zindilis
LQ Newbie
 
Registered: Feb 2012
Location: Limassol, Cyprus
Posts: 8

Rep: Reputation: Disabled
Hello,

Any user can execute passwd and subsequently update /etc/shadow, because the passwd executable has Set User ID (SUID) set, which essentially means that the program runs with the permissions of its owner, no matter which user calls it. You can see the permissions of the executable:

Code:
yovan marios # ls -l /usr/bin/passwd 
-rwsr-xr-x 1 root root 42824 2011-06-24 12:28 /usr/bin/passwd
The "s" in the permissions string indicates just that.

It's strange that you say that /etc/shadow is a soft link. You can verify if it is, and see a link's target with ls -l. Do:
Code:
ls -l /etc/shadow
and you will see if it's a link, and where it links.
 
1 members found this post helpful.
Old 02-09-2012, 02:47 AM   #4
aol.aman
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks Droyden and Marios. I had been told that /etc/shadow is a symbolic link of an another file. That's confirmed that it is not a softlink, but is a hard link to any file? Thanks again !!
 
Old 02-09-2012, 03:51 AM   #5
Marios Zindilis
LQ Newbie
 
Registered: Feb 2012
Location: Limassol, Cyprus
Posts: 8

Rep: Reputation: Disabled
Again, you can see that from the output of ls -l.

The number after the permissions is the number of hardlinks that point to the same file or directory. All files have at least 1 hardlink, which is the file itself. All directories have at least 2 hardlinks, which are . and ..
 
1 members found this post helpful.
Old 02-10-2012, 09:28 AM   #6
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
may i ask in what context is the question being posed? student, self learner, linux admin, etc?
 
Old 02-10-2012, 08:02 PM   #7
aol.aman
LQ Newbie
 
Registered: Oct 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks Marios !! /etc/shadow

@ Linux_Kidd - I was told that /etc/shadow file is a symbolic file , in interview with company Redhat. Which file is it linked to? That's what I am trying to figure out. I presumed it must /etc/passwd but it doesn't has any symbolic link.


ls -lt /etc/shadow
-r-------- 1 root root 6243 Feb 4 08:08 /etc/shadow

ls -l /etc/passwd
-rw-r--r-- 1 root root 14992 Feb 4 08:08 /etc/passwd


If there a explict symbolic link on a file, file permission's 1st bit would be 'l' representing it is a symbolic link
and the count would be greater than 2. (Please correct me if i am wrong)
something like:-

lrwxrwxrwx 1 bediaman bediaman 4 Feb 7 00:20 test1 -> test

Last edited by aol.aman; 02-10-2012 at 08:12 PM.
 
Old 02-11-2012, 12:56 PM   #8
Linux_Kidd
Member
 
Registered: Jan 2006
Location: USA
Posts: 737

Rep: Reputation: 78
these files are not linked. shadow and passwd or two totally different text files, and neither is linked to the binary "passwd".
 
  


Reply



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 share a folder in samba with no need of user password with write permission golden_boy615 Linux - Newbie 3 06-15-2011 08:09 PM
How to changes Happened in /etc/shadow file, when user changing password deepak_message Linux - Server 1 01-24-2011 06:10 AM
How can i check a string with actual user passwd (ie password in /etc/shadow) iamjayanth Linux - Software 6 09-29-2009 01:34 AM
user password failed after migrating /etc/shadow, /etc/passwd ect from SUSE9 to CenOS monkeyxu Linux - Newbie 1 05-21-2009 09:42 AM
how to give the permission to user to change his password ramesh14 Linux - Newbie 2 11-19-2008 01:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 04:28 PM.

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
Open Source Consulting | Domain Registration