Linux password file LOKED

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 !

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


    Boot into single user mode and edit /etc/shadow.

save and reboot.

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

'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'
alextesiAuthor Commented:
i can login into my linux distribution.
but i can't add new user.
the error
file passwd locked
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

what is the attrib of the /etc/passwd??

can you post the result of 'ls -l /etc/passwd' and 'ls -l /etc/shadow' here?
alextesiAuthor Commented:
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
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
• 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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 :)
thanks for the points alextesi, glad to have helped :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.