?
Solved

Linux password file LOKED

Posted on 2004-11-16
8
Medium Priority
?
368 Views
Last Modified: 2013-12-15
Hi i have a problem with the password file of my debian sarge.
The password file is loked.
Can you help me ?

If you need any other information ask me !


alextesi
0
Comment
Question by:alextesi
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 12600071
Hi,

    Boot into single user mode and edit /etc/shadow.
change
root:$x$lMhxxE70sV1:12696:0:99999:7:::
tp
root:::12696:0:99999:7:::

save and reboot.

There is no root password. Then
# password root
to change the root password.

Wesly
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 12601614
'The password file is loked.'

you mean you lost your file? or the file locked?

what's the error you got when you login ?

or do you mean you lost your login password? or the root login password?

if you lost the login password or the root login password, wesly_chen already told you how to recover the login password, which is by removing the password record in /etc/shadow.

wesly_chen have a typo mistake, to change the password you should use 'passwd root'
0
 
LVL 1

Author Comment

by:alextesi
ID: 12604196
i can login into my linux distribution.
but i can't add new user.
the error
file passwd locked
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:paullamhkg
ID: 12622597
what is the attrib of the /etc/passwd??

can you post the result of 'ls -l /etc/passwd' and 'ls -l /etc/shadow' here?
0
 
LVL 1

Author Comment

by:alextesi
ID: 12642976
Here you are:

-rw-r--r--  1 root root 5206 2004-11-22 10:01 /etc/passwd
-rw-r-----  1 root shadow 4374 2004-11-22 10:01 /etc/shadow

Bye alextesi
0
 
LVL 4

Accepted Solution

by:
Nemesis-Services earned 500 total points
ID: 12645342
it's most likely due to this command: chattr
chattr - change file attributes on a Linux second extended file system


The immutable bit can be used to prevent accidentally deleting or overwriting a file that must be
protected. It also prevents someone from creating a symbolic link to this file, which has been the
source of attacks involving the deletion of “/etc/passwd”, “/etc/shadow”, “/etc/group” or
“/etc/gshadow”.
• To set the immutable bit on the passwords and groups files, use the command:

[root@deep /]# chattr +i /etc/passwd
[root@deep /]# chattr +i /etc/shadow
[root@deep /]# chattr +i /etc/group
[root@deep /]# chattr +i /etc/gshadow

NOTE: In the future, if you intend to add or delete users, passwords, usergroups, or group files,
you must unset the immutable bit on all those files or you will not be able to make your changes.
Also if you intend to install an RPM program that will automatically add a new user to the different
immunized passwd and group files, then you will receive an error message during the install if
you have not unset the immutable bit from those files.

so try this command:
chattr -i /etc/passwd
chattr -i /etc/shadow
chattr -i /etc/group
chattr -i /etc/gshadow
0
 
LVL 12

Expert Comment

by:paullamhkg
ID: 12661279
Nemesis-Services gave you good hints, try to read the manpage of the chattr (man chattr) before you do anything on it. since there is lots of attributes can be add to the file(s) by using the chattr.

Also backup the /etc/passwd and /etc/shadow before you do anything on it, so that even anything goes wrong you can get back the original to recover :)
0
 
LVL 4

Expert Comment

by:Nemesis-Services
ID: 12926777
thanks for the points alextesi, glad to have helped :)
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I have written articles previously comparing SARDU and YUMI.  I also included a couple of lines about Easy2boot (easy2boot.com).  I have now been using, and enjoying easy2boot as my sole multiboot utility for some years and realize that it deserves …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month16 days, 19 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question