Need your help on permission of /etc/shadow!

Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Need your help on permission of /etc/shadow!
# 1  
Old 08-01-2011
Need your help on permission of /etc/shadow!

Dear all,

I need all of you to clarify about file permission and SUID, SGID as below:


$ ls -la /etc/passwd
-r--r--r-- 1 root root 1914 2011-04-15 11:22 /etc/passwd
# I've changed permission of this file

$ ls -la /etc/shadow
-r--r----- 1 root shadow 1397 2011-08-01 15:53 /etc/shadow
# I've changed permission of this file

$ ls -la /usr/bin/passwd 
-rwsr-xr-x 1 root root 37100 2011-02-15 05:12 /usr/bin/passwd.

When i change my account with command:
$ password myaccount
Enter newpass: Successful

I wonder why /etc/shadow (/etc/password) still is written although they are not set +w on root.

Please help me to explain accordingly!
Sorry for my English and Thank all of you much.

---------- Post updated at 04:38 PM ---------- Previous update was at 04:34 PM ----------

Dear all,

My Linux is Ubuntu 11.04 Desktop.


Last edited by pludi; 08-01-2011 at 07:02 AM..
# 2  
Old 08-01-2011
Because /usr/bin/passwd is a SUID root executable.
# 3  
Old 08-01-2011
Thanks fpmurphy!

But i want to know that why /etc/password and /etc/shadow still updated (written) by password command.

As i said, i've set permission on /etc/password and /etc/shadow only with READ permission.

# 4  
Old 08-02-2011
The SUID (Set User ID) bit tells the kernel to run a program (not script) using the UID assigned to the file, in this case root. And root always has the permissions to change any file. Which is why SUID binaries should be used only very very rarely, and only if you know what that program is doing.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Need a help with /etc/shadow

Hi, I wanna see the content of the file /etc/shadow.. But i don't have the permission and also the root permission. Still is it possible to view it??? Any tricks?? (5 Replies)
Discussion started by: Adhi
5 Replies

2. UNIX for Dummies Questions & Answers

Shadow file help

As a part of linux hardening In shadow file all Application accounts which are not locked must contain only an asterisk * in the Passwd field. But how would i do it by using command? Is there any way other than modifying shadow file to accomplish this task? (3 Replies)
Discussion started by: pinga123
3 Replies

3. UNIX for Dummies Questions & Answers

'!!' in /etc/shadow

I notice there are '*'s and '!!'s in my /etc/shadow file. And I know these are for preventing login. But what are the differences among '*', '!' and '!!' ? THX! mail:*:14789:0:99999:7::: uucp:*:14789:0:99999:7::: ... dbus:!!:14919:::::: rpc:!!:14919:0:99999:7::: ...... (4 Replies)
Discussion started by: vistastar
4 Replies

4. UNIX for Dummies Questions & Answers

Understanding /etc/shadow

What do the !! signify below in this /etc/shadow entry? apache:!!:13713:0:99999:7::: (4 Replies)
Discussion started by: mojoman
4 Replies

5. Shell Programming and Scripting

Shadow file

Hi, In shadow file smithj:Ep6mckrOLChF.:10063:0:99999:7::: 3rd Field 10063 indicates the number of days (since January 1, 1970) since the password was last changed. I want to get the result with script the date on which the password was last changed in YYYY-MM-DD format. can... (8 Replies)
Discussion started by: pinnacle
8 Replies

6. UNIX for Dummies Questions & Answers

shadow entry

In /etc/shadow ..we have all the user entries ..? Like when ever an user is created a corresponding entry is created in /etc/shadow...? (2 Replies)
Discussion started by: rachna
2 Replies

7. UNIX for Advanced & Expert Users

/etc/shadow file....

Does anyone know what "!!" represents in the password field of the /etc/shadow file? :confused: (6 Replies)
Discussion started by: avcert1998
6 Replies

8. Programming

Shadow Passwords

I'm writing a 'C' program on various systems (HP-UX, Solaris, AIX, NCR) which needs to interact with a user's password. Some of my systems are using the shadow password and some are not. It is possible for some of my systems to have /etc/shadow, even though the box is not using the file (I know,... (4 Replies)
Discussion started by:
4 Replies

9. UNIX for Advanced & Expert Users

shadow file

what does 'x' in the encrypted password field in /etc/shaodw file represent? (3 Replies)
Discussion started by: jbashir
3 Replies

10. UNIX for Dummies Questions & Answers


Can some one explain to me how to disable the Shadow file or disconnect it from the passwd file. I am trying to configure a UNIX SCO box to use NIS and it continues to look at its own Shadow file. Thanks (5 Replies)
Discussion started by: mokie44
5 Replies
Login or Register to Ask a Question