# \[macOS\] User in database lock is root

**URL:** <https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525>\
**Category:** User Manual\
**Tags:** macos\
**Created:** [September 7, 2025, 2:55pm UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525 "2025-09-07T14:55:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![csam](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/csam/32/5361_2.png) [@csam](https://gramps.discourse.group/u/csam)\
**Post date:** [September 7, 2025, 2:55pm UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525/1 "2025-09-07T14:55:54Z")

</div>

During translation of the user manual I ‘killed -9’ Gramps in order to make screenshots of the popup windows that appear, when a database is locked at start of Gramps.  
To my surprise the user name in the lock file is ‘root’ !!  
How can this happen? I never run applications as root.

 ![example database locked](https://global.discourse-cdn.com/free1/uploads/gramps/original/2X/f/f1dea35d40a890694aa611ee0de2860c4b9101a9.png)

---

<div class="post-metadata">

**Author:** ![csam](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/csam/32/5361_2.png) [@csam](https://gramps.discourse.group/u/csam)\
**Post date:** [September 8, 2025, 7:23am UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525/2 "2025-09-08T07:23:53Z")

</div>

Looking at the utils.py for the method to create the lock file:

```python
host = os.uname()[1]
# An ugly workaround for os.getlogin() issue with Konsole
try:
    user = os.getlogin()
except:
    # not win, so don't need get_env_var.
    # under cron getlogin() throws and there is no USER.
    user = os.environ.get("USER", "noUSER")

```

A smal test program

```python
import os

user = os.getlogin()
print(user)
user = os.environ.get("USER", "noUSER")
print(user)

```

prints the actual user, so I’m really worried if some code in Gramps is running as root and thereby compromises security.

---

<div class="post-metadata">

**Author:** ![GaryGriffin](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/garygriffin/32/6525_2.png) [@GaryGriffin](https://gramps.discourse.group/u/GaryGriffin)\
**Post date:** [September 8, 2025, 10:01pm UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525/3 "2025-09-08T22:01:09Z")

</div>

If I run ARM Gramps 6.0.4 from [command line](https://gramps-project.org/wiki/index.php/Gramps_6.0_Wiki_Manual_-_Command_Line), the lock is owned by my username. If I run thru Finder and click on the app, the lock is owned by root. Very strange.

My suggestion is to file a bug and assign to jralls.

---

<div class="post-metadata">

**Author:** ![csam](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/csam/32/5361_2.png) [@csam](https://gramps.discourse.group/u/csam)\
**Post date:** [September 9, 2025, 7:04am UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525/4 "2025-09-09T07:04:08Z")

</div>

Thanks Gary.

Bug [#13981](https://gramps-project.org/bugs/view.php?id=13981) created, however I’m not able to assign the report to anyone.

---

<div class="post-metadata">

**Author:** ![GaryGriffin](https://yyz2.discourse-cdn.com/free1/user_avatar/gramps.discourse.group/garygriffin/32/6525_2.png) [@GaryGriffin](https://gramps.discourse.group/u/GaryGriffin)\
**Post date:** [September 9, 2025, 3:04pm UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525/5 "2025-09-09T15:04:26Z")

</div>

Added to your bug report.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/gramps/original/1X/2ac1e712b7adf612e31ca08a55419f4cf37c0158.png) [@system](https://gramps.discourse.group/u/system)\
**Post date:** [October 9, 2025, 3:04pm UTC](https://gramps.discourse.group/t/macos-user-in-database-lock-is-root/8525/6 "2025-10-09T15:04:51Z")

</div>

Closed on October 9, 2025, 3:04pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
