mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #6185] Add ${USER} macro (containing username of user who runs the firejail) #3213
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#3213
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @msva on GitHub (Feb 1, 2024).
Original GitHub issue: https://github.com/netblue30/firejail/issues/6185
Hi there!
Sometimes, when I write profiles for my software, I facing situations when I need to
mkdir/mkfilesomething in, say,/tmp/<username>for example, but I don't want to hardcode username in profiles, and want to make them username-agnostic.And, as far as I see in fj manpage and in wiki here on GH, there is no such macro that would help me with that.
Much closer thing is
${RUNUSER}, but it links to/run/user/<UID>, while I sometimes need paths exactly containing username.Would you please add a macro
${USER}(as corresponding variable in shells) or, at least,${USERNAME}that will contain the username of the current user?@msva commented on GitHub (Feb 1, 2024):
by the way, maybe it will also be good to add XDG_CACHE_HOME macro (which will inherit corresponding value from environment variable during execution) too (to be able to pre-create cache directory before running the program, whatever value it will have on user's system)
I will hellp to solve issues like
When mesa trying to create a place for shaders cache.
@kmk3 commented on GitHub (Feb 1, 2024):
@msva on Feb 1:
+1 for
${USER}.Though note that currently macros are only allowed at the beginning of paths.
The relevant code only handles that case and
{}and some other shellmetacharacters are rejected outside of the macro itself. Example:
For now I'd suggest using shell script wrappers to create the paths. Example:
~/bin/myprogram:
@kmk3 commented on GitHub (Feb 1, 2024):
@msva on Feb 1:
Please open a separate issue for this.
Considering that there is currently support for some XDG-related macros (such
as
${DOCUMENTS}), this may or may not be easier to implement.Though note that
private-cacheexists and that it may make more sense toallow a path argument to it instead (such as
private-cache /tmp/mva/.cacheinyour example).
See also the following discussion: