---
title: "Running Homebrew on Linux with Multiple Users"
description: "Share a Linuxbrew installation between multiple users on one Linux machine by fixing group permissions on the Cellar and adding Git safe directory entries."
canonical: https://omiid.me/notebook/49/running-homebrew-on-linux-with-multiple-users
author: Omid Sayfun
published: 2026-05-11
updated: 2026-08-09
---

# Running Homebrew on Linux with Multiple Users

A Linuxbrew install belongs to the account that created it. I installed Homebrew on my Linux machine under one user account, then set up a second account and assumed the only remaining step was dropping the shell env line into `.bashrc`. It wasn't. Sharing one brew install across multiple users takes two fixes, in this order: group permissions on the install tree, then Git safe directory entries.

## Problem 1: The Cellar is not writable by the second user

The steps below assume you installed Homebrew on Linux the normal way, at the default prefix `/home/linuxbrew/.linuxbrew`. The first error looks like this:

```
Error: /home/linuxbrew/.linuxbrew/Cellar is not writable.
```

The fix is to create a shared group, add both users to it, and set group ownership and permissions on the entire Homebrew tree:

```bash
# Create a shared group
sudo groupadd linuxbrew

# Add both users
sudo usermod -aG linuxbrew user1
sudo usermod -aG linuxbrew user2

# Set group ownership and permissions
sudo chgrp -R linuxbrew /home/linuxbrew/.linuxbrew
sudo chmod -R g+rwx /home/linuxbrew/.linuxbrew

# Set the setgid bit so new files inherit the group
sudo find /home/linuxbrew/.linuxbrew -type d -exec chmod g+s {} \;

# Let the second user traverse the parent directory
sudo chmod 755 /home/linuxbrew
```

Log out and back in for the group membership to take effect.

## Problem 2: Git refuses to run in a repo owned by another user

After fixing permissions, `brew update` started throwing a different error:

```
Warning: No remote 'origin' in /home/linuxbrew/.linuxbrew/Homebrew, skipping update!
fatal: detected dubious ownership in repository at '/home/linuxbrew/.linuxbrew/Homebrew'
```

This is Git's safe-directory check, and it is the same detected dubious ownership in repository error you get on any repo owned by another account. The Homebrew repo is owned by the first user, so Git refuses to operate on it when the second user runs `brew`. The fix is to mark the Homebrew directories as trusted for the second user:

```bash
git config --global --add safe.directory /home/linuxbrew/.linuxbrew/Homebrew
git config --global --add safe.directory /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core
# add any other tap paths that show up in the error
```

After that, `brew update` ran cleanly and everything worked as expected.

## The short version

To share a Linuxbrew install across accounts: fix group ownership so both users can write to the cellar, then mark the Homebrew Git repos as safe directories for each additional user. Two separate problems, two separate fixes. Neither is complicated once you know what you're looking at.
