Can I lock the passwd and shadow files
![](https://seccdn.libravatar.org/avatar/60a1fb93535bd08629edd67957af2558.jpg?s=120&d=mm&r=g)
I have a need to obtain an exclusive lock on the shadow, group, and passwd files so that any process trying to modify these files will be blocked/denied until the lock is removed. I am not extremelly familiar with SuSE internals and etc.. I want to temporarily lock these files from either a perl of C program, preferably perl. It would take me many lines to explain line, but I simply need to lock these files so that no other process may modify them. (This lock would be held for a very short amount of time, but the process obtaining this lock is no where near atomic) These are clinical systems reponsisble for monitoring life support equipment among other things, so a 'jerry-rig' approach will not suffice. I need a 100%, rock solid way of this locking this file. Can anyone lead me in the right direction? Thanks CC
![](https://seccdn.libravatar.org/avatar/4ec991e518f97d6bb6a9440ed78bda80.jpg?s=120&d=mm&r=g)
On Tue, Mar 27, 2001 at 03:05:07PM -0800, suse@rhugga.org wrote:
I have a need to obtain an exclusive lock on the shadow, group, and passwd files so that any process trying to modify these files will be blocked/denied until the lock is removed. I am not extremelly familiar with SuSE internals and etc.. I want to temporarily lock these files from either a perl of C program, preferably perl. It would take me many lines to explain line, but I simply need to lock these files so that no other process may modify them. (This lock would be held for a very short amount of time
, but the process obtaining this lock is no where near atomic) These are clinical systems reponsisble for monitoring life support equipment among other things, so a 'jerry-rig' approach will not suffice. I need a 100%, rock solid way of this locking this file. [in future, could you please limit your line lengths to about 75 characters? Thanks.] I'm enclosing two programs - one in C, and one in PERL that do what you want. -- David Smith Tel: +44 (0)1454 462380 (direct) STMicroelectronics Fax: +44 (0)1454 617910 1000 Aztec West TINA (ST only): (065) 2380 Almondsbury Home: 01454 616963 BRISTOL Mobile: 07932 642724 BS32 4SQ Work Email: Dave.Smith@st.com Home Email: David.Smith@ds-electronics.co.uk
![](https://seccdn.libravatar.org/avatar/60a1fb93535bd08629edd67957af2558.jpg?s=120&d=mm&r=g)
On Tue, Mar 27, 2001 at 03:05:07PM -0800, suse@rhugga.org wrote:
I have a need to obtain an exclusive lock on the shadow, group, and
Save, Thankx for the help, but I think I need to reword what I am asking. I know how to code locking, I was wanting to know if the passwd util that comes with SuSE 7.0 repects exclusive locks. Having an exclusive lock over a file does not mean another process cannot write to it, but they should repect an exclusive lock. I have seen problems from this arise on Solaris, since some of the core utlities lag way behing, such as their broken 'tar' among other things. I guess I could dig through the code of the passwd util, but I was hoping someone here had been over this before. Thankx for the help, CC ----- Original Message ----- From: "Dave Smith" <Dave.Smith@st.com> To: <suse@rhugga.org> Cc: <suse-linux-e@suse.com> Sent: Wednesday, March 28, 2001 1:39 AM Subject: Re: [SLE] Can I lock the passwd and shadow files passwd files so that any process trying to modify these files will be blocked/denied until the lock is removed. I am not extremelly familiar with SuSE internals and etc.. I want to temporarily lock these files from either a perl of C program, preferably perl. It would take me many lines to explain line, but I simply need to lock these files so that no other process may modify them. (This lock would be held for a very short amount of time
, but the process obtaining this lock is no where near atomic) These are clinical systems reponsisble for monitoring life support equipment among other things, so a 'jerry-rig' approach will not suffice. I need a 100%, rock solid way of this locking this file.
[in future, could you please limit your line lengths to about 75 characters? Thanks.] I'm enclosing two programs - one in C, and one in PERL that do what you want.
-- David Smith Tel: +44 (0)1454 462380 (direct) STMicroelectronics Fax: +44 (0)1454 617910 1000 Aztec West TINA (ST only): (065) 2380 Almondsbury Home: 01454 616963 BRISTOL Mobile: 07932 642724 BS32 4SQ Work Email: Dave.Smith@st.com Home Email: David.Smith@ds-electronics.co.uk
---------------------------------------------------------------------------- ----
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq
participants (3)
-
Dave Smith
-
Rhugga
-
SuSe List