cancel
Showing results for 
Search instead for 
Did you mean: 

Lock file

SOLVED
Go to solution
juno2
Super Advisor

Lock file

I found the below problem in the RH system , when one user is changing the password by the command "passwd " , the another can't change the password at the same time , because it will first first locks /etc/.pwd.lock to prevent concurrent updates
the file /etc/passwd , I tried to change the mode of .pwd.lock to 777 , it still can't allow the another to login at the same time , can I disable the lock password file function ? if not can suggest what I can do except remove the file ? thx.
1 REPLY
Martin P.J. Zinser
Honored Contributor
Solution

Re: Lock file

What you are seeing is the result of a design decision in Unix in general. Files are essantially structureless, which allows the "everything is a file" attitude. This also means that without additional layers of software you can not have a record level lock on a file. So you either have to lock the file itself or a proxy (the .pwd.lock in your case) and no short of removing it and/or killing the process that holds it I do not see a a possibility to have a second process updating the file while the first tries to change the password. Obviously removing the lock does open another can of worms.
As I said this is a Unix decision. E.g. the hp OpenVMS operating system supports indexed files native and changing a passwort locks exactly this users record in the "passwd" file.