Just so you realize ..... you are defeating the purpose of the "lock file" (in general)

Now this may be OK in your special case of being the only user on your computer (even though your OS allows multiple"users" (note that user is from the computer's point of view; you as a single human COULD be multiple users*). Just be careful to avoid this. By disabling the computer's ability to detect multiple users going after the resource, it becomes your responsibility.

Michael D Novack

* For example, assuming your as regular user do not have administrator rights, when installing updates you might get prompted for your administrator password. What might actually be happening is the computer logging you in as administrator, doing the update, then logging out. During that time period had two users logged in.


On 6/13/2025 2:12 AM, James Thorpe wrote:
Thank you, R Losey, your explanation allowed me to solve my problem!

To clarify the problem for others - I was trying to create a read-only copy of a gnucash file so that I could open it to draw reports and get figures without inadvertently making changes... which happen rather easily in gnucash.

Here's how I solved it (in Linux, at least... similar process from windows except using the GUI I suppose).

I created the lock file manually

touch Household_2024_2025.gnucash.LCK

Set the lock file to read-only

chmod a-w Household_2024_2025.gnucash.LCK

Thereafter, any time I opened the main file (Household_2024_2025), gnucash would prompt me to open read-only... which is exactly what I wanted. Also, when closing, gnucash is unable to delete the lock file so the file remains protected.

This works on a network file share as well so when I open from gnucash on windows the same process happens.

On 2025/06/12 17:59, R Losey wrote:
The issue is that the directory has write permission, which allows files to be renamed.

So, GnuCash reads the read-only file, and then, when it goes to "save" the file, it renames the old file and creates a new one. It IS a little unusual to have a just-written file NOT have "write" permissions; I assume GnuCash just clones the existing permissions.

If you want an archived version, I would copy the appropriate .gnucash file to some kind of archive directory... for example, if the path to your regular GnuCash files ends with ".../gnucash/", you could create a ".../gnucashARCHIVE/" to hold your archive files. The only problem is that if you make the directory read-only, you may not be able to open the files, as GnuCash couldn't create the log files. There may be an option in GnuCash to open a file as read-only (because I know that if the LCK file is present, one option is to open the file as read-only).


On Thu, Jun 12, 2025 at 1:35 AM James Thorpe <[email protected]> wrote:

    Hi All

    I'm using Version: 5.11, Build ID: Flathub 5.11-2 on Linux Mint 21
    and I
    recently noticed that even if I set the user permissions on my
    gnucash
    file to read-only (eg. chmod a-w gc.gnucash) and then open the
    file with
    GnuCash, I'm able to update the file from GnuCash and when I close it
    again, I notice the permissions have changed back to rw.

    After my chmod command, it looks like this

    -r-xr-xr-x  1 james james  86022 Jun  9 14:17 gc.gnucash

    If I then open gnucash and this file and make changes, a bunch of
    logs
    etc appear

    -rw-r--r--  1 james james    359 Jun 12 08:26
    gc.gnucash.20250612082607.log
    -r-xr-xr-x  1 james james  86181 Jun 12 08:26 gc.gnucash
    -rw-r--r--  1 james james    679 Jun 12 08:26
    gc.gnucash.20250612082600.log
    -r-xr-xr-x  1 james james  86022 Jun 12 08:25
    gc.gnucash.20250612082607.gnucash

    but the original file gc.gnucash remains read-only. But the
    changes are
    there and have been saved, even if I delete the logs and other files.

    Bottom line - I'm trying to save a read-only copy of a file that I'm
    done with and just want for reporting/ reference purposes. How do
    I do that?

    I'm guessing it's a flatpak thing because it doesn't seem to do
    this on
    Windows version... even if I access the same file on a shared network
    folder.

    thanks for any suggestions.

    James Thorpe

    On 2025/06/11 18:00, [email protected] wrote:
    > Send gnucash-user mailing list submissions to
    > [email protected]
    >
    > To subscribe or unsubscribe via the World Wide Web, visit
    > https://lists.gnucash.org/mailman/listinfo/gnucash-user
    > or, via email, send a message with subject or body 'help' to
    > [email protected]
    >
    > You can reach the person managing the list at
    > [email protected]
    >
    > When replying, please edit your Subject line so it is more specific
    > than "Re: Contents of gnucash-user digest..."
    >
    >
    > Today's Topics:
    >
    >     1.  No longer able to access my accounting software (Mark
    Penner)
    >     2. Re:  Suggestion to Accept Bitcoin/Lightning/Monero Donations
    >        (David Carlson)
    >
    >
    >
----------------------------------------------------------------------
    >
    > Message: 1
    > Date: Wed, 11 Jun 2025 09:46:30 -0500 (CDT)
    > From: Mark Penner<[email protected]>
    > To:[email protected] <mailto:to%[email protected]>
    > Subject: [GNC] No longer able to access my accounting software
    > Message-ID:<[email protected]>
    > Content-Type: text/plain; charset=UTF-8
    >
    > Jun 11, 2025 05:01:46 Vik Sha via
    gnucash-user<[email protected]>:
    >
    >> I keep getting the following messages every time I try to open it :
    > If you're trying to send an image, you need to attach it, the
    mailing list software strips inline images.
    >
    > If the message you're getting says something like "unable to
    obtain lock for file", and you're SURE that the file is not open
    (e.g. in another GnuCash instance), just click "Open Anyway"
    >
    >
    > ------------------------------
    >
    > Message: 2
    > Date: Wed, 11 Jun 2025 09:56:50 -0500
    > From: David Carlson<[email protected]>
    > To: 83281<[email protected]>
    > Cc:[email protected] <mailto:cc%[email protected]>
    > Subject: Re: [GNC] Suggestion to Accept Bitcoin/Lightning/Monero
    >       Donations
    > Message-ID:
    >
 <cadygsbm5fwek+1vpwti_xaffvz+mgfoays9cr8rmj4qbck5...@mail.gmail.com
<mailto:cadygsbm5fwek%2b1vpwti_xaffvz%[email protected]>>
    > Content-Type: text/plain; charset="UTF-8"
    >
    > I hope the developers can identify whether this is phishing or
    worse!!!!!
    >
    > On Wed, Jun 11, 2025 at 5:02?AM 83281 via gnucash-user <
    > [email protected]> wrote:
    >
    >> Hello,
    >>
    >> I hope this message finds you well. I am a supporter of your
    open-source
    >> project GnuCash and would like to make a donation. However, I
    noticed that
    >> you currently do not accept Bitcoin, Lightning, or Monero.
    >>
    >> Privacy is very important to me, as it is to many other
    open-source users
    >> and advocates. Supporting privacy-respecting donation methods
    like Bitcoin
    >> and Monero would likely encourage more people to contribute.
    These options
    >> also operate independently of banks and intermediaries, which
    aligns with
    >> the values of a freer and more open world.
    >>
    >> Would you consider adding the option to donate via Bitcoin
    (on-chain and
    >> maybe even Lightning) or Monero? If you need any assistance
    implementing
    >> this, I would be happy to help.
    >>
    >> The easiest way to get started is by downloading Cake Wallet,
    which is
    >> open-source, non-custodial, and supports both Bitcoin and
    Monero (as well
    >> as other cryptocurrencies). You could then simply display the
    wallet
    >> address on your website for donations.
    >>
    >> Thank you for your work and for considering this suggestion.
    Please let me
    >> know if you have any questions or if I can assist in any way.
    >>
    >> Best regards!
    >> _______________________________________________
    >> gnucash-user mailing list
    >> [email protected]
    >> To update your subscription preferences or to unsubscribe:
    >> https://lists.gnucash.org/mailman/listinfo/gnucash-user
    >> -----
    >> Please remember to CC this list on all your replies.
    >> You can do this by using Reply-To-List or Reply-All.
    >>
    >
    --     --
    James Thorpe
    061 476 2775
    [email protected]
    _______________________________________________
    gnucash-user mailing list
    [email protected]
    To update your subscription preferences or to unsubscribe:
    https://lists.gnucash.org/mailman/listinfo/gnucash-user
    -----
    Please remember to CC this list on all your replies.
    You can do this by using Reply-To-List or Reply-All.



--
_________________________________
Richard Losey
[email protected]
Micah 6:8


--
There is no possibility of social justice on a dead planet except the equality 
of the grave.

_______________________________________________
gnucash-user mailing list
[email protected]
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to