[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: add user ?




> Yes, there is a race condition here one that is *very* difficult to get
> rid of with shell scripts. To get this to work properly you do need an
> atomic operation, in C this is done with an OPEN(O_CREAT|O_EXCL) which
> (excluding NFS) is atomic.


> > What is wrong with my adduser script ?
> > (of course, I can fix it by hands - use ln instead of touch for example)
> 
> How does this help? You still have a window of opportunity between the
> check and the creation of the file. 
I always thought that link is atomic even on NFS ...

> > How is /etc/group file locked ?
> 
> Where, in adduser? Using the same /etc/.pwd.lock file.
Do other programs that read /etc/group support this locking convetion ?

Sasha



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []