[GH-ISSUE #3787] [Question] Can an app read the username of the user's home dir on linux? #2391

Closed
opened 2026-05-05 09:04:08 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @svc88 on GitHub (Dec 3, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3787

If an app wanted to, could it read the username of the homedir that it for example uses to store app data? I assume it can

I ask this because if a user for example has Skype, Telegram, Discord etc.. but the user has multiple accounts on an app like these and wants to switch between them by renaming the active data dir, the app can then potentially link all switched accounts, since it could read the username from the homedir path that it uses for its data dir.

Having taken into account other security measures to ensure that the app runs through a tor bridge, etc. My question only relates to the homedir username that the app can link to. Can firejail already somehow "mask" the username so that the app does not see it? Or is there a possibility that this could or should become a feature?

Originally created by @svc88 on GitHub (Dec 3, 2020). Original GitHub issue: https://github.com/netblue30/firejail/issues/3787 If an app wanted to, could it read the username of the homedir that it for example uses to store app data? I assume it can I ask this because if a user for example has Skype, Telegram, Discord etc.. but the user has multiple accounts on an app like these and wants to switch between them by renaming the active data dir, the app can then potentially link all switched accounts, since it could read the username from the homedir path that it uses for its data dir. Having taken into account other security measures to ensure that the app runs through a tor bridge, etc. My question only relates to the homedir username that the app can link to. Can firejail already somehow "mask" the username so that the app does not see it? Or is there a possibility that this could or should become a feature?
gitea-mirror 2026-05-05 09:04:08 -06:00
Author
Owner

@SkewedZeppelin commented on GitHub (Dec 3, 2020):

If an app wanted to, could it read the username of the homedir that it for example uses to store app data? I assume it can

Yes, it can.
And it can also read your environment variables.

If you need such isolation between identities I'd suggest using virtualization
or Qubes OS.

<!-- gh-comment-id:738442768 --> @SkewedZeppelin commented on GitHub (Dec 3, 2020): > If an app wanted to, could it read the username of the homedir that it for example uses to store app data? I assume it can Yes, it can. And it can also read your environment variables. If you need such isolation between identities I'd suggest using virtualization or Qubes OS.
Author
Owner

@rusty-snake commented on GitHub (Dec 4, 2020):

Actually /etc/machine-id is much more unique then a username.

<!-- gh-comment-id:738715996 --> @rusty-snake commented on GitHub (Dec 4, 2020): Actually `/etc/machine-id` is much more unique then a username.
Author
Owner

@svc88 commented on GitHub (Dec 14, 2020):

Actually /etc/machine-id is much more unique then a username.

Cant you blacklist this specific file from being read?

<!-- gh-comment-id:744621179 --> @svc88 commented on GitHub (Dec 14, 2020): > Actually `/etc/machine-id` is much more unique then a username. Cant you blacklist this specific file from being read?
Author
Owner

@rusty-snake commented on GitHub (Dec 14, 2020):

You can blacklist /etc/machine-id or spoof machine-id. However, sound will be broken.


An app on your system can also match IP (e.g. 1.2.3.4) + OS (linux) + UID (e.g. 1000) + HW details (e.g 8GB RAM, Intel CPU, AMD GPU, ...), which will be quite unique too.

<!-- gh-comment-id:744625518 --> @rusty-snake commented on GitHub (Dec 14, 2020): You can `blacklist /etc/machine-id` or spoof `machine-id`. However, sound will be broken. ---- An app on your system can also match IP (e.g. 1.2.3.4) + OS (linux) + UID (e.g. 1000) + HW details (e.g 8GB RAM, Intel CPU, AMD GPU, ...), which will be quite unique too.
Author
Owner

@svc88 commented on GitHub (Dec 14, 2020):

You can blacklist /etc/machine-id or spoof machine-id. However, sound will be broken.

I did:

sudo rm -f /etc/machine-id
sudo dbus-uuidgen --ensure=/etc/machine-id

Then i tried sound on one of the apps, it still worked until i restarted the app then sound stopped working. However its better running these cmd's just before you're about to reboot PC. My question now is, would it help or be ok to keep re-generating a new id before every reboot?

Am aware of Qubes, but wondering if there is a way to spoof the username in the path too, just out of interest.

<!-- gh-comment-id:744669918 --> @svc88 commented on GitHub (Dec 14, 2020): > You can `blacklist /etc/machine-id` or spoof `machine-id`. However, sound will be broken. I did: ``` sudo rm -f /etc/machine-id sudo dbus-uuidgen --ensure=/etc/machine-id ``` Then i tried sound on one of the apps, it still worked until i restarted the app then sound stopped working. However its better running these cmd's just before you're about to reboot PC. My question now is, would it help or be ok to keep re-generating a new id before every reboot? Am aware of Qubes, but wondering if there is a way to spoof the username in the path too, just out of interest.
Author
Owner

@rusty-snake commented on GitHub (Dec 14, 2020):

My question now is, would it help or be ok to keep re-generating a new id before every reboot?

I think systemd-machine-id-setup will generate a new one if delete it on shut down. However, as I pointed in my comment above, there are hundred ways for a app to link accounts if it wants.

<!-- gh-comment-id:744675606 --> @rusty-snake commented on GitHub (Dec 14, 2020): > My question now is, would it help or be ok to keep re-generating a new id before every reboot? I think systemd-machine-id-setup will generate a new one if delete it on shut down. However, as I pointed in my comment above, there are hundred ways for a app to link accounts if it wants.
Author
Owner

@rusty-snake commented on GitHub (Jan 4, 2021):

I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.

<!-- gh-comment-id:753926663 --> @rusty-snake commented on GitHub (Jan 4, 2021): I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#2391
No description provided.