I have a database called oss-pwds.kdb located in a folder /keepassx. This is a password database that I use with the KeePassX software. I want to allow all members of the "oss" group to open and modify the database, but not to inadvertently delete it.

Here is what I have:

groupadd oss
chgrp oss /keepassx
chown root /keepassx
chown root /keepassx/oss-pwds.kdb
chmod 1770 /keepassx
chmod 1770 /keepassx/oss-pwds.kdb

At first, it looks like this should work. However, if I open the database in the KeePassX software, make a change, then try to save it, a .tmp file appears in the /keepassx directory and I get an error upon saving: "File could not be saved. The file could not be removed."

How do I prevent deletion of only the oss-pwds.kdb file but allow deletion of other files in the /keepassx directory such as the .tmp file?