SANDBOX(8)
welcome to section 8, User Commands, bestie β this is the sandbox(8) page, and yes it's about locking an app in a little SELinux glass case so it can't touch your stuff. sit down, hydrate, we're doing this. π
πΈ NAME πΈ
sandbox β run cmd under an SELinux sandbox. that's the whole thing. short, sweet, iconic. π
π¦ SYNOPSIS π¦
sandbox [-C] [-s] [ -d DPI ] [-l level ] [[-M | -X] -H homedir -T
tempdir ] [ -R runuserdir ] [-I includefile ] [ -W windowmanager ] [ -w
windowsize ] [[-i file ]...] [ -t type ] cmd
sandbox [-C] [-s] [ -d DPI ] [-l level ] [[-M | -X] -H homedir -T
tempdir ] [ -R runuserdir ] [-I includefile ] [ -W windowmanager ] [ -w
windowsize ] [[-i file ]...] [ -t type ] -S
two whole forms, the second one is just the first one but ending in -S. slay. β¨
π DESCRIPTION π
so what's actually happening? you run the cmd application inside a tightly confined SELinux domain. read that again. tightly confined. π
the default sandbox domain gives applications exactly one (1) privilege: read and write stdin, stdout, and any other file descriptors that get handed to it. it is not allowed to open any other files. not one. none. zero. that's the whole point, and honestly? main character energy. π
the -M option will mount an alternate homedir and tmpdir to be used by the sandbox. cute little fake house for your app. π
if you have the policycoreutils-sandbox package installed, you unlock the -X option and the -M option. sandbox -X lets you run X applications inside a sandbox. these applications will start up their own X Server and create a temporary home directory and /tmp. it's giving tiny apartment.
the default SELinux policy does not allow any capabilities or network access. it also prevents all access to the user's other processes and files. like, all of them. blocked. no cap. π
files specified on the command that are in the home directory or /tmp will be copied into the sandbox directories. so bring your snacks, they get their own copies. π
if directories are specified with -H or -T the directory will have its context modified with chcon(1) unless a level is specified with -l. and if the MLS/MCS security level is specified, the user is responsible to set the correct labels. that's on you, bestie, not on the tool. π«Ά
π the options (yes, all of them) π
-h,--helpβ display usage message. the classic. the icon.-H,--homedirβ Use alternatehomedirto mount over your home directory. Defaults to temporary. Requires-Xor-M.-i,--includeβ Copy this file into the appropriate temporary sandbox directory. Command can be repeated.-I,--includefileβ Copy all files listed ininputfileinto the appropriate temporary sandbox directories.-l,--levelβ Specify the MLS/MCS Security Level to run the sandbox with. Defaults to random. π²-M,--mountβ Create a Sandbox with temporary files for$HOMEand/tmp.-s,--shredβ Shred temporary files created in$HOMEand/tmp, before deleting. dramatic and correct. π₯-t,--typeβ Use alternate sandbox type, defaults tosandbox_torsandbox_x_tfor-X.- Examples:
sandbox_t- No X, No Network Access, No Open, read/write on passed in file descriptors.sandbox_min_t- No Network Accesssandbox_x_t- Ports for X applications to run locallysandbox_web_t- Ports required for web browsingsandbox_net_t- Network ports (for server software)sandbox_net_client_t- All network ports
-T,--tmpdirβ Use alternate temporary directory to mount on/tmp. Defaults totmpfs. Requires-Xor-M.-R,--runuserdirβ Use alternate temporary directory to mount onXDG_RUNTIME_DIR(/run/user/$UID).-S,--sessionβ Run a full desktop session, Requires level, and home and tmpdir.-w,--windowsizeβ Specifies the windowsize when creating an X based Sandbox. The default windowsize is1000x700.-W,--windowmanagerβ Select alternative window manager to run withinsandbox -X. Default to/usr/bin/matchbox-window-manager.-Xβ Create an X based Sandbox for gui apps, temporary files for$HOMEand/tmp, secondary Xserver, defaults tosandbox_x_t-d,--dpiβ Set the DPI value for the sandbox X Server. Defaults to the current X Sever DPI.-C,--capabilitiesβ Use capabilities within the sandbox. By default applications executed within the sandbox will not be allowed to use capabilities (setuid apps), with the-Cflag, you can use programs requiring capabilities.
real talk: that -t list is doing a lot of heavy lifting. memorize it or don't, but it's all here, fr fr. π
π₯ SEE ALSO π₯
runcon(1), seunshare(8), selinux(8)
go read those next, bestie, they're the friends of this page. π¦
π EXAMPLE π
Run a graphical application inside the sandbox
# sandbox -X evince
Run a graphical application that requires the use of network
# sandbox βX βt sandbox_web_t firefox
Preserve data from one session to the next
# mkdir -p ~/sandbox/home ~/sandbox/tmp
# sandbox -H ~/sandbox/home -T ~/sandbox/tmp -X libreoffice --writer
literally copy-paste these, that's what they're for. π
π AUTHOR π
This manual page was written by Dan Walsh <dwalsh@redhat.com> and Thomas Liu <tliu@fedoraproject.org>
okay that's the whole page, you made it, I'm so proud. π«Ά this sandbox page (source sandbox, dated May 2010, sitting pretty in section SANDBOX(8)) is officially yours now. go confine something. periodt. π
β¨
π¦ where this page comes from
- centos-stream 10: policycoreutils-sandbox 3.11-1.el10 Β· GPL-2.0-or-later
- centos-stream 9: policycoreutils-sandbox 3.6-9.el9 Β· GPL-2.0-or-later
- fedora 43: policycoreutils-sandbox 3.9-7.fc43 Β· GPL-2.0-or-later
- fedora 44: policycoreutils-sandbox 3.10-1.fc44 Β· GPL-2.0-or-later
- fedora 44: policycoreutils-sandbox 3.11-2.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms